Skip to content

Commit 572fa50

Browse files
authored
Sonic -> Grok Code Fast (RooCodeInc#7426)
1 parent a79c3d0 commit 572fa50

File tree

26 files changed

+161
-107
lines changed

26 files changed

+161
-107
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import type { ModelInfo } from "../model.js"
22

33
// Roo provider with single model
4-
export type RooModelId = "roo/sonic"
4+
export type RooModelId = "xai/grok-code-fast-1"
55

6-
export const rooDefaultModelId: RooModelId = "roo/sonic"
6+
export const rooDefaultModelId: RooModelId = "xai/grok-code-fast-1"
77

88
export const rooModels = {
9-
"roo/sonic": {
9+
"xai/grok-code-fast-1": {
1010
maxTokens: 16_384,
1111
contextWindow: 262_144,
1212
supportsImages: false,
1313
supportsPromptCache: true,
1414
inputPrice: 0,
1515
outputPrice: 0,
1616
description:
17-
"A stealth reasoning model that is blazing fast and excels at agentic coding, accessible for free through Roo Code Cloud for a limited time. (Note: prompts and completions are logged by the model creator and used to improve the model.)",
17+
"A reasoning model that is blazing fast and excels at agentic coding, accessible for free through Roo Code Cloud for a limited time. (Note: the free prompts and completions are logged by xAI and used to improve the model.)",
1818
},
1919
} as const satisfies Record<string, ModelInfo>

packages/types/src/providers/xai.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,20 @@ import type { ModelInfo } from "../model.js"
33
// https://docs.x.ai/docs/api-reference
44
export type XAIModelId = keyof typeof xaiModels
55

6-
export const xaiDefaultModelId: XAIModelId = "grok-4"
6+
export const xaiDefaultModelId: XAIModelId = "grok-code-fast-1"
77

88
export const xaiModels = {
9+
"grok-code-fast-1": {
10+
maxTokens: 16_384,
11+
contextWindow: 262_144,
12+
supportsImages: false,
13+
supportsPromptCache: true,
14+
inputPrice: 0.2,
15+
outputPrice: 1.5,
16+
cacheWritesPrice: 0.02,
17+
cacheReadsPrice: 0.02,
18+
description: "xAI's Grok Code Fast model with 256K context window",
19+
},
920
"grok-4": {
1021
maxTokens: 8192,
1122
contextWindow: 256000,

packages/types/src/single-file-read-models.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,11 @@
44
* instead of the more complex multi-file args format
55
*/
66

7-
// List of model IDs (or patterns) that should use single file reads only
8-
export const SINGLE_FILE_READ_MODELS = new Set<string>(["roo/sonic"])
9-
107
/**
118
* Check if a model should use single file read format
129
* @param modelId The model ID to check
1310
* @returns true if the model should use single file reads
1411
*/
1512
export function shouldUseSingleFileRead(modelId: string): boolean {
16-
// Direct match
17-
if (SINGLE_FILE_READ_MODELS.has(modelId)) {
18-
return true
19-
}
20-
21-
// Pattern matching for model families
22-
// Check if model ID starts with any configured pattern
23-
// Using Array.from for compatibility with older TypeScript targets
24-
const patterns = Array.from(SINGLE_FILE_READ_MODELS)
25-
for (const pattern of patterns) {
26-
if (pattern.endsWith("*") && modelId.startsWith(pattern.slice(0, -1))) {
27-
return true
28-
}
29-
}
30-
31-
return false
13+
return modelId.includes("grok-code-fast-1")
3214
}

src/api/providers/__tests__/roo.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ describe("RooHandler", () => {
115115

116116
beforeEach(() => {
117117
mockOptions = {
118-
apiModelId: "roo/sonic",
118+
apiModelId: "xai/grok-code-fast-1",
119119
}
120120
// Set up CloudService mocks for successful authentication
121121
mockHasInstanceFn.mockReturnValue(true)
@@ -313,8 +313,8 @@ describe("RooHandler", () => {
313313
const modelInfo = handler.getModel()
314314
expect(modelInfo.id).toBe(mockOptions.apiModelId)
315315
expect(modelInfo.info).toBeDefined()
316-
// roo/sonic is a valid model in rooModels
317-
expect(modelInfo.info).toBe(rooModels["roo/sonic"])
316+
// xai/grok-code-fast-1 is a valid model in rooModels
317+
expect(modelInfo.info).toBe(rooModels["xai/grok-code-fast-1"])
318318
})
319319

320320
it("should return default model when no model specified", () => {

src/core/webview/ClineProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class ClineProvider
120120

121121
public isViewLaunched = false
122122
public settingsImportedAt?: number
123-
public readonly latestAnnouncementId = "aug-20-2025-stealth-model" // Update for stealth model announcement
123+
public readonly latestAnnouncementId = "aug-25-2025-grok-code-fast" // Update for Grok Code Fast announcement
124124
public readonly providerSettingsManager: ProviderSettingsManager
125125
public readonly customModesManager: CustomModesManager
126126

webview-ui/src/components/chat/Announcement.tsx

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,65 @@ const Announcement = ({ hideAnnouncement }: AnnouncementProps) => {
4242
<DialogTitle>{t("chat:announcement.title", { version: Package.version })}</DialogTitle>
4343
</DialogHeader>
4444
<div>
45-
<ul className="space-y-2">
46-
<li>
47-
{" "}
45+
<div className="space-y-2">
46+
<div>
4847
<Trans
4948
i18nKey="chat:announcement.stealthModel.feature"
5049
components={{
5150
bold: <b />,
51+
code: <code className="px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded" />,
5252
}}
5353
/>
54-
</li>
55-
</ul>
54+
</div>
55+
</div>
5656

57-
<p className="text-xs text-muted-foreground mt-2">{t("chat:announcement.stealthModel.note")}</p>
57+
<div className="mt-4">
58+
<Trans
59+
i18nKey="chat:announcement.stealthModel.note"
60+
components={{
61+
bold: <b />,
62+
code: <code className="px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded" />,
63+
}}
64+
/>
65+
</div>
5866

5967
<div className="mt-4">
6068
{!cloudIsAuthenticated ? (
61-
<Button
62-
onClick={() => {
63-
vscode.postMessage({ type: "rooCloudSignIn" })
64-
}}
65-
className="w-full">
66-
{t("chat:announcement.stealthModel.connectButton")}
67-
</Button>
69+
<div className="space-y-3">
70+
<div className="text-sm w-full">
71+
<Trans
72+
i18nKey="chat:announcement.stealthModel.selectModel"
73+
components={{
74+
code: <code className="px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded" />,
75+
settingsLink: (
76+
<VSCodeLink
77+
href="#"
78+
onClick={(e) => {
79+
e.preventDefault()
80+
setOpen(false)
81+
hideAnnouncement()
82+
window.postMessage(
83+
{
84+
type: "action",
85+
action: "settingsButtonClicked",
86+
values: { section: "provider" },
87+
},
88+
"*",
89+
)
90+
}}
91+
/>
92+
),
93+
}}
94+
/>
95+
</div>
96+
<Button
97+
onClick={() => {
98+
vscode.postMessage({ type: "rooCloudSignIn" })
99+
}}
100+
className="w-full">
101+
{t("chat:announcement.stealthModel.connectButton")}
102+
</Button>
103+
</div>
68104
) : (
69105
<div className="text-sm w-full">
70106
<Trans

webview-ui/src/components/chat/__tests__/Announcement.spec.tsx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ vi.mock("@src/i18n/TranslationContext", () => ({
2525
return `🎉 Roo Code ${options?.version} Released`
2626
}
2727
if (key === "chat:announcement.stealthModel.feature") {
28-
return "Stealth reasoning model with advanced capabilities"
28+
return "The Sonic stealth model is now Grok Code Fast!"
2929
}
3030
if (key === "chat:announcement.stealthModel.note") {
31-
return "Note: This is an experimental feature"
31+
return "As a thank you for all the helpful feedback about Sonic, you'll also continue to have free access to the grok-code-fast-1 model for another week through the Roo Code Cloud provider."
3232
}
3333
if (key === "chat:announcement.stealthModel.connectButton") {
3434
return "Connect to Roo Code Cloud"
@@ -43,10 +43,23 @@ vi.mock("@src/i18n/TranslationContext", () => ({
4343
vi.mock("react-i18next", () => ({
4444
Trans: ({ i18nKey, children }: { i18nKey?: string; children: React.ReactNode }) => {
4545
if (i18nKey === "chat:announcement.stealthModel.feature") {
46-
return <>Stealth reasoning model with advanced capabilities</>
46+
return (
47+
<>
48+
The Sonic stealth model is now Grok Code Fast! The fast reasoning model is now available as
49+
grok-code-fast-1 under the &ldquo;xAI (Grok)&rdquo; provider.
50+
</>
51+
)
4752
}
4853
if (i18nKey === "chat:announcement.stealthModel.selectModel") {
49-
return <>Please select the roo/sonic model in settings</>
54+
return <>Visit Settings to get started</>
55+
}
56+
if (i18nKey === "chat:announcement.stealthModel.note") {
57+
return (
58+
<>
59+
As a thank you for all the helpful feedback about Sonic, you&rsquo;ll also continue to have free
60+
access to the grok-code-fast-1 model for another week through the Roo Code Cloud provider.
61+
</>
62+
)
5063
}
5164
return <>{children}</>
5265
},
@@ -77,11 +90,11 @@ describe("Announcement", () => {
7790
// Check if the mocked version number is present in the title
7891
expect(screen.getByText(`🎉 Roo Code ${expectedVersion} Released`)).toBeInTheDocument()
7992

80-
// Check if the stealth model feature is displayed (using partial match due to bullet point)
81-
expect(screen.getByText(/Stealth reasoning model with advanced capabilities/)).toBeInTheDocument()
93+
// Check if the Grok Code Fast feature is displayed
94+
expect(screen.getByText(/The Sonic stealth model is now Grok Code Fast!/)).toBeInTheDocument()
8295

8396
// Check if the note is displayed
84-
expect(screen.getByText("Note: This is an experimental feature")).toBeInTheDocument()
97+
expect(screen.getByText(/As a thank you for all the helpful feedback about Sonic/)).toBeInTheDocument()
8598

8699
// Check if the connect button is displayed (since cloudIsAuthenticated is false in the mock)
87100
expect(screen.getByText("Connect to Roo Code Cloud")).toBeInTheDocument()

webview-ui/src/components/ui/hooks/useSelectedModel.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,21 @@ function getSelectedModel({
308308
return { id, info }
309309
}
310310
case "roo": {
311-
const id = apiConfiguration.apiModelId ?? rooDefaultModelId
312-
const info = rooModels[id as keyof typeof rooModels]
313-
return { id, info }
311+
const requestedId = apiConfiguration.apiModelId
312+
313+
// Check if the requested model exists in rooModels
314+
if (requestedId && rooModels[requestedId as keyof typeof rooModels]) {
315+
return {
316+
id: requestedId,
317+
info: rooModels[requestedId as keyof typeof rooModels],
318+
}
319+
}
320+
321+
// Fallback to default model if requested model doesn't exist or is not specified
322+
return {
323+
id: rooDefaultModelId,
324+
info: rooModels[rooDefaultModelId as keyof typeof rooModels],
325+
}
314326
}
315327
case "qwen-code": {
316328
const id = apiConfiguration.apiModelId ?? qwenCodeDefaultModelId

webview-ui/src/i18n/locales/ca/chat.json

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

webview-ui/src/i18n/locales/de/chat.json

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

0 commit comments

Comments
 (0)