Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion apps/cli/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { config } from "@roo-code/config-eslint/base"
import { createProviderIdentifierConfig } from "@roo-code/config-eslint/provider-identifiers"
import { providerIdentifiers, retiredProviderIdentifiers } from "@roo-code/types/provider-identifiers"

/** @type {import("eslint").Linter.Config} */
export default [...config]
export default [
...config,
createProviderIdentifierConfig({ providerIdentifiers, retiredProviderIdentifiers }),
]
5 changes: 3 additions & 2 deletions apps/cli/src/agent/__tests__/extension-host.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { providerIdentifiers } from "@roo-code/types"
// pnpm --filter @roo-code/cli test src/agent/__tests__/extension-host.test.ts

import { EventEmitter } from "events"
Expand Down Expand Up @@ -28,7 +29,7 @@ vi.mock("@/lib/storage/index.js", () => ({
*/
function createTestHost({
mode = "code",
provider = "openrouter",
provider = providerIdentifiers.openrouter,
model = "test-model",
...options
}: Partial<ExtensionHostOptions> = {}): ExtensionHost {
Expand Down Expand Up @@ -113,7 +114,7 @@ describe("ExtensionHost", () => {
extensionPath: "/my/extension",
user: null,
apiKey: "test-key",
provider: "openrouter",
provider: providerIdentifiers.openrouter,
model: "test-model",
ephemeral: false,
debug: false,
Expand Down
15 changes: 8 additions & 7 deletions apps/cli/src/lib/storage/__tests__/settings.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { providerIdentifiers } from "@roo-code/types"
import fs from "fs/promises"
import path from "path"

Expand Down Expand Up @@ -58,7 +59,7 @@ describe("Settings Storage", () => {
const settingsData = {
onboardingProviderChoice: OnboardingProviderChoice.Byok,
mode: "architect",
provider: "anthropic" as const,
provider: providerIdentifiers.anthropic,
model: "claude-sonnet-4-20250514",
reasoningEffort: "high" as const,
}
Expand Down Expand Up @@ -95,7 +96,7 @@ describe("Settings Storage", () => {

it("should merge settings with existing ones", async () => {
await saveSettings({ mode: "code" })
await saveSettings({ provider: "openrouter" as const })
await saveSettings({ provider: providerIdentifiers.openrouter })

const savedData = await fs.readFile(expectedSettingsFile, "utf-8")
const settings = JSON.parse(savedData)
Expand All @@ -107,7 +108,7 @@ describe("Settings Storage", () => {
it("should save all default settings fields", async () => {
await saveSettings({
mode: "architect",
provider: "anthropic" as const,
provider: providerIdentifiers.anthropic,
model: "claude-opus-4.6",
reasoningEffort: "medium" as const,
consecutiveMistakeLimit: 5,
Expand Down Expand Up @@ -155,7 +156,7 @@ describe("Settings Storage", () => {
await saveSettings({
onboardingProviderChoice: OnboardingProviderChoice.Byok,
mode: "architect",
provider: "gemini" as const,
provider: providerIdentifiers.gemini,
})

await resetOnboarding()
Expand All @@ -172,7 +173,7 @@ describe("Settings Storage", () => {
// Test that all the settings that can be used as defaults are properly saved and loaded
const defaultSettings = {
mode: "debug",
provider: "openai-native" as const,
provider: providerIdentifiers.openaiNative,
model: "gpt-4o",
reasoningEffort: "low" as const,
consecutiveMistakeLimit: 7,
Expand Down Expand Up @@ -205,7 +206,7 @@ describe("Settings Storage", () => {
it("should support all settings together including requireApproval", async () => {
const allSettings = {
mode: "architect",
provider: "anthropic" as const,
provider: providerIdentifiers.anthropic,
model: "claude-sonnet-4-20250514",
reasoningEffort: "high" as const,
requireApproval: true,
Expand All @@ -231,7 +232,7 @@ describe("Settings Storage", () => {
it("should support all settings together including oneshot", async () => {
const allSettings = {
mode: "architect",
provider: "anthropic" as const,
provider: providerIdentifiers.anthropic,
model: "claude-sonnet-4-20250514",
reasoningEffort: "high" as const,
consecutiveMistakeLimit: 9,
Expand Down
4 changes: 2 additions & 2 deletions apps/cli/src/types/__tests__/types.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { providerIdentifiers } from "@roo-code/types"
import { providerIdentifiers, retiredProviderIdentifiers } from "@roo-code/types"

import { isSupportedProvider, supportedProviders } from "../types.js"

Expand All @@ -20,7 +20,7 @@ describe("isSupportedProvider", () => {
})

it("returns false for 'roo' (retired provider)", () => {
expect(isSupportedProvider("roo")).toBe(false)
expect(isSupportedProvider(retiredProviderIdentifiers.roo)).toBe(false)
})

it("returns false for unknown provider", () => {
Expand Down
3 changes: 2 additions & 1 deletion apps/cli/src/ui/__tests__/store.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { providerIdentifiers } from "@roo-code/types"
import { RooCodeSettings } from "@roo-code/types"

import { useCLIStore } from "../store.js"
Expand Down Expand Up @@ -168,7 +169,7 @@ describe("useCLIStore", () => {
})

it("should PRESERVE apiConfiguration", () => {
const config: RooCodeSettings = { apiProvider: "openai", apiModelId: "gpt-4" }
const config: RooCodeSettings = { apiProvider: providerIdentifiers.openai, apiModelId: "gpt-4" }

useCLIStore
.getState()
Expand Down
3 changes: 3 additions & 0 deletions apps/vscode-e2e/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { config } from "@roo-code/config-eslint/base"
import { createProviderIdentifierConfig } from "@roo-code/config-eslint/provider-identifiers"
import { providerIdentifiers, retiredProviderIdentifiers } from "@roo-code/types/provider-identifiers"

/** @type {import("eslint").Linter.Config} */
export default [
Expand All @@ -15,4 +17,5 @@ export default [
"@typescript-eslint/no-floating-promises": "error",
},
},
createProviderIdentifierConfig({ providerIdentifiers, retiredProviderIdentifiers }),
]
5 changes: 3 additions & 2 deletions apps/vscode-e2e/src/suite/anthropic-opus-4-7.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { providerIdentifiers } from "@roo-code/types"
import * as assert from "assert"
import { createServer, type IncomingMessage, type ServerResponse } from "http"

Expand Down Expand Up @@ -177,7 +178,7 @@ suite("Claude Opus 4.7 (Anthropic)", function () {
const aimockUrl = process.env.AIMOCK_URL
const isRecord = process.env.AIMOCK_RECORD === "true"
await globalThis.api.setConfiguration({
apiProvider: "openrouter" as const,
apiProvider: providerIdentifiers.openrouter,
openRouterApiKey: aimockUrl && !isRecord ? "mock-key" : process.env.OPENROUTER_API_KEY!,
openRouterModelId: "openai/gpt-4.1",
...(aimockUrl && { openRouterBaseUrl: `${aimockUrl}/v1` }),
Expand All @@ -203,7 +204,7 @@ suite("Claude Opus 4.7 (Anthropic)", function () {
// aimock handles /v1/messages natively and serves Anthropic-format SSE responses.
// In record mode the real x-api-key is forwarded so aimock can proxy to api.anthropic.com.
await api.setConfiguration({
apiProvider: "anthropic" as const,
apiProvider: providerIdentifiers.anthropic,
apiKey: aimockUrl && !isRecord ? "mock-key" : process.env.ANTHROPIC_API_KEY!,
apiModelId: "claude-opus-4-7",
enableReasoningEffort: reasoningEnabled,
Expand Down
3 changes: 2 additions & 1 deletion apps/vscode-e2e/src/suite/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { providerIdentifiers } from "@roo-code/types"
import * as path from "path"
import Mocha from "mocha"
import { glob } from "glob"
Expand All @@ -20,7 +21,7 @@ export async function run() {
const isRecord = process.env.AIMOCK_RECORD === "true"

await api.setConfiguration({
apiProvider: "openrouter" as const,
apiProvider: providerIdentifiers.openrouter,
// In record mode, forward the real key so aimock can proxy it to OpenRouter.
// In replay mode, "mock-key" is sufficient — aimock never contacts the real API.
openRouterApiKey: aimockUrl && !isRecord ? "mock-key" : process.env.OPENROUTER_API_KEY!,
Expand Down
11 changes: 6 additions & 5 deletions apps/vscode-e2e/src/suite/providers/bedrock.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { providerIdentifiers } from "@roo-code/types"
import * as assert from "assert"

import { startBedrockMockServer, type BedrockMockServer } from "../../bedrock-mock-server"
Expand Down Expand Up @@ -26,7 +27,7 @@ suite("Bedrock provider", function () {
if (!aimockUrl && BEDROCK_LIVE_E2E && AWS_BEARER_TOKEN_BEDROCK) {
// Live mode — explicitly opted into real AWS credentials, no aimock intercepting traffic.
await globalThis.api.setConfiguration({
apiProvider: "bedrock" as const,
apiProvider: providerIdentifiers.bedrock,
awsUseApiKey: true,
awsApiKey: AWS_BEARER_TOKEN_BEDROCK,
awsRegion: BEDROCK_REGION,
Expand All @@ -38,7 +39,7 @@ suite("Bedrock provider", function () {
// deserializer to drop the delta field (take() reads top-level only).
mockServer = await startBedrockMockServer()
await globalThis.api.setConfiguration({
apiProvider: "bedrock" as const,
apiProvider: providerIdentifiers.bedrock,
awsUseApiKey: true,
awsApiKey: "mock-key",
awsRegion: BEDROCK_REGION,
Expand All @@ -56,7 +57,7 @@ suite("Bedrock provider", function () {
const aimockUrl = process.env.AIMOCK_URL
const isRecord = process.env.AIMOCK_RECORD === "true"
await globalThis.api.setConfiguration({
apiProvider: "openrouter" as const,
apiProvider: providerIdentifiers.openrouter,
openRouterApiKey: aimockUrl && !isRecord ? "mock-key" : process.env.OPENROUTER_API_KEY!,
openRouterModelId: "openai/gpt-4.1",
...(aimockUrl && { openRouterBaseUrl: `${aimockUrl}/v1` }),
Expand Down Expand Up @@ -108,15 +109,15 @@ suite("Bedrock provider", function () {
// formation end-to-end.
if (!process.env.AIMOCK_URL && BEDROCK_LIVE_E2E && AWS_BEARER_TOKEN_BEDROCK) {
await api.setConfiguration({
apiProvider: "bedrock" as const,
apiProvider: providerIdentifiers.bedrock,
awsUseApiKey: true,
awsApiKey: AWS_BEARER_TOKEN_BEDROCK,
awsRegion: BEDROCK_REGION,
apiModelId: BEDROCK_OPUS_48_MODEL_ID,
})
} else {
await api.setConfiguration({
apiProvider: "bedrock" as const,
apiProvider: providerIdentifiers.bedrock,
awsUseApiKey: true,
awsApiKey: "mock-key",
awsRegion: BEDROCK_REGION,
Expand Down
5 changes: 3 additions & 2 deletions apps/vscode-e2e/src/suite/providers/deepseek-v4.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { providerIdentifiers } from "@roo-code/types"
import * as assert from "assert"
import * as fs from "fs/promises"
import * as path from "path"
Expand Down Expand Up @@ -211,7 +212,7 @@ async function runDeepSeekToolProbe(

try {
await api.setConfiguration({
apiProvider: "deepseek" as const,
apiProvider: providerIdentifiers.deepseek,
deepSeekApiKey: aimockUrl && !isRecord ? "mock-key" : DEEPSEEK_API_KEY!,
...(aimockUrl && { deepSeekBaseUrl: `${aimockUrl}/v1` }),
apiModelId: modelId,
Expand Down Expand Up @@ -336,7 +337,7 @@ suite("DeepSeek V4 provider", function () {
const aimockUrl = process.env.AIMOCK_URL
const isRecord = process.env.AIMOCK_RECORD === "true"
await globalThis.api.setConfiguration({
apiProvider: "openrouter" as const,
apiProvider: providerIdentifiers.openrouter,
openRouterApiKey: aimockUrl
? isRecord
? (process.env.OPENROUTER_API_KEY ?? "mock-key")
Expand Down
5 changes: 3 additions & 2 deletions apps/vscode-e2e/src/suite/providers/gemini.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { providerIdentifiers } from "@roo-code/types"
import * as assert from "assert"

import { RooCodeEventName, type ClineMessage } from "@roo-code/types"
Expand Down Expand Up @@ -190,7 +191,7 @@ suite("Gemini provider", function () {
const aimockUrl = process.env.AIMOCK_URL
const isRecord = process.env.AIMOCK_RECORD === "true"
await globalThis.api.setConfiguration({
apiProvider: "openrouter" as const,
apiProvider: providerIdentifiers.openrouter,
openRouterApiKey: aimockUrl && !isRecord ? "mock-key" : process.env.OPENROUTER_API_KEY!,
openRouterModelId: "openai/gpt-4.1",
...(aimockUrl && { openRouterBaseUrl: `${aimockUrl}/v1` }),
Expand All @@ -207,7 +208,7 @@ suite("Gemini provider", function () {
const promptTag = `gemini-e2e:reasoning-${reasoningEffort}`

await api.setConfiguration({
apiProvider: "gemini" as const,
apiProvider: providerIdentifiers.gemini,
geminiApiKey: aimockUrl && !isRecord ? "mock-key" : GEMINI_API_KEY!,
apiModelId: GEMINI_MODEL_ID,
enableReasoningEffort: reasoningEffort !== "disable",
Expand Down
3 changes: 2 additions & 1 deletion apps/vscode-e2e/src/suite/providers/openrouter.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { providerIdentifiers } from "@roo-code/types"
import * as assert from "assert"

import { setDefaultSuiteTimeout } from "../test-utils"
Expand Down Expand Up @@ -93,7 +94,7 @@ suite("OpenRouter provider", function () {
restoreFetch = installOpenRouterRequestCapture(requests, baseUrl)

await globalThis.api.setConfiguration({
apiProvider: "openrouter" as const,
apiProvider: providerIdentifiers.openrouter,
openRouterApiKey: aimockUrl && !isRecord ? "mock-key" : OPENROUTER_API_KEY!,
openRouterModelId: "anthropic/claude-haiku-4-5",
...(aimockUrl && { openRouterBaseUrl: `${aimockUrl}/v1` }),
Expand Down
7 changes: 4 additions & 3 deletions apps/vscode-e2e/src/suite/providers/xai.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { providerIdentifiers } from "@roo-code/types"
import * as assert from "assert"
import * as fs from "fs/promises"
import * as path from "path"
Expand Down Expand Up @@ -336,7 +337,7 @@ async function runXAIToolProbe(

try {
await api.setConfiguration({
apiProvider: "xai" as const,
apiProvider: providerIdentifiers.xai,
xaiApiKey: XAI_API_KEY ?? "mock-key",
apiModelId: modelId,
})
Expand Down Expand Up @@ -549,7 +550,7 @@ suite("xAI provider", function () {
)

await globalThis.api.setConfiguration({
apiProvider: "xai" as const,
apiProvider: providerIdentifiers.xai,
xaiApiKey: XAI_API_KEY ?? "mock-key",
apiModelId: XAI_MODEL_ID,
})
Expand All @@ -569,7 +570,7 @@ suite("xAI provider", function () {
const aimockUrl = process.env.AIMOCK_URL
const isRecord = process.env.AIMOCK_RECORD === "true"
await globalThis.api.setConfiguration({
apiProvider: "openrouter" as const,
apiProvider: providerIdentifiers.openrouter,
openRouterApiKey: aimockUrl && !isRecord ? "mock-key" : process.env.OPENROUTER_API_KEY!,
openRouterModelId: "openai/gpt-4.1",
...(aimockUrl && { openRouterBaseUrl: `${aimockUrl}/v1` }),
Expand Down
5 changes: 3 additions & 2 deletions apps/vscode-e2e/src/suite/providers/zai.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { providerIdentifiers } from "@roo-code/types"
import * as assert from "assert"

import { RooCodeEventName, type ClineMessage } from "@roo-code/types"
Expand All @@ -21,7 +22,7 @@ type ZAiRequestCapture = { maxTokens?: number }

function getBaseZAiConfiguration() {
return {
apiProvider: "zai" as const,
apiProvider: providerIdentifiers.zai,
zaiApiKey: ZAI_API_KEY ?? "mock-key",
zaiApiLine: "international_api" as const,
modelMaxTokens: undefined,
Expand Down Expand Up @@ -197,7 +198,7 @@ suite("Z.ai GLM provider", function () {
await globalThis.api.upsertProfile(
"default",
{
apiProvider: "openrouter" as const,
apiProvider: providerIdentifiers.openrouter,
openRouterApiKey: aimockUrl && !isRecord ? "mock-key" : process.env.OPENROUTER_API_KEY!,
openRouterModelId: "openai/gpt-4.1",
...(aimockUrl && { openRouterBaseUrl: `${aimockUrl}/v1` }),
Expand Down
3 changes: 2 additions & 1 deletion apps/vscode-e2e/src/suite/subtasks.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { providerIdentifiers } from "@roo-code/types"
import * as assert from "assert"

import { RooCodeEventName, type ClineMessage } from "@roo-code/types"
Expand Down Expand Up @@ -735,7 +736,7 @@ suite("Roo Code Subtasks", function () {

const aimockUrl = process.env.AIMOCK_URL
const parentProfile = {
apiProvider: "openrouter" as const,
apiProvider: providerIdentifiers.openrouter,
openRouterApiKey: "mock-key",
openRouterModelId: "openai/gpt-4.1",
rateLimitSeconds: 0,
Expand Down
5 changes: 3 additions & 2 deletions apps/vscode-e2e/src/suite/tools/apply-diff.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { providerIdentifiers } from "@roo-code/types"
import * as assert from "assert"
import * as fs from "fs/promises"
import * as path from "path"
Expand Down Expand Up @@ -110,7 +111,7 @@ suite("Roo Code apply_diff Tool", function () {
const isRecord = process.env.AIMOCK_RECORD === "true"

await globalThis.api.setConfiguration({
apiProvider: "openrouter" as const,
apiProvider: providerIdentifiers.openrouter,
openRouterApiKey: aimockUrl && !isRecord ? "mock-key" : process.env.OPENROUTER_API_KEY!,
openRouterModelId: "anthropic/claude-sonnet-4.5",
...(aimockUrl && { openRouterBaseUrl: `${aimockUrl}/v1` }),
Expand All @@ -136,7 +137,7 @@ suite("Roo Code apply_diff Tool", function () {
const aimockUrl = process.env.AIMOCK_URL
const isRecord = process.env.AIMOCK_RECORD === "true"
await globalThis.api.setConfiguration({
apiProvider: "openrouter" as const,
apiProvider: providerIdentifiers.openrouter,
openRouterApiKey: aimockUrl && !isRecord ? "mock-key" : process.env.OPENROUTER_API_KEY!,
openRouterModelId: "openai/gpt-4.1",
...(aimockUrl && { openRouterBaseUrl: `${aimockUrl}/v1` }),
Expand Down
Loading
Loading