From 50fa676a501531b24e97b7ee1db60c25b65212ee Mon Sep 17 00:00:00 2001 From: nang-dev Date: Fri, 7 Mar 2025 17:36:37 -0500 Subject: [PATCH 1/3] Progress --- src/api/providers/pearai.ts | 5 +++++ src/shared/api.ts | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/api/providers/pearai.ts b/src/api/providers/pearai.ts index deae483bf5a..ca825243c08 100644 --- a/src/api/providers/pearai.ts +++ b/src/api/providers/pearai.ts @@ -108,6 +108,11 @@ export class PearAiHandler { id: baseModel.id, info: { ...baseModel.info, + // Inherit all capabilities from the underlying model + supportsImages: baseModel.info.supportsImages, + supportsComputerUse: baseModel.info.supportsComputerUse, + supportsPromptCache: baseModel.info.supportsPromptCache, + // Apply PearAI's price markup inputPrice: (baseModel.info.inputPrice || 0) * 1.03, outputPrice: (baseModel.info.outputPrice || 0) * 1.03, cacheWritesPrice: baseModel.info.cacheWritesPrice ? baseModel.info.cacheWritesPrice * 1.03 : undefined, diff --git a/src/shared/api.ts b/src/shared/api.ts index 767e2d3a48a..c217f9121dc 100644 --- a/src/shared/api.ts +++ b/src/shared/api.ts @@ -802,8 +802,11 @@ export const pearAiDefaultModelId: PearAiModelId = "pearai-model" export const pearAiDefaultModelInfo: ModelInfo = { maxTokens: 8192, contextWindow: 64000, - supportsImages: false, + // Default values for required fields, but actual values will be inherited from underlying model supportsPromptCache: true, + supportsImages: false, + supportsComputerUse: false, + // Base pricing inputPrice: 0.014, outputPrice: 0.28, cacheWritesPrice: 0.27, @@ -816,8 +819,11 @@ export const pearAiModels = { "pearai-model": { maxTokens: 8192, contextWindow: 64000, - supportsImages: false, + // Default values for required fields, but actual values will be inherited from underlying model supportsPromptCache: true, + supportsImages: false, + supportsComputerUse: false, + // Base pricing inputPrice: 0.014, outputPrice: 0.28, cacheWritesPrice: 0.27, From cdceffecc3831906e5adc05b3bc8ad20a3bd7c2c Mon Sep 17 00:00:00 2001 From: nang-dev Date: Fri, 7 Mar 2025 18:00:06 -0500 Subject: [PATCH 2/3] Fixed --- webview-ui/src/components/settings/ApiOptions.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/webview-ui/src/components/settings/ApiOptions.tsx b/webview-ui/src/components/settings/ApiOptions.tsx index dd644bdf871..2496f09a41c 100644 --- a/webview-ui/src/components/settings/ApiOptions.tsx +++ b/webview-ui/src/components/settings/ApiOptions.tsx @@ -118,7 +118,7 @@ const ApiOptions = ({ ) const { selectedProvider, selectedModelId, selectedModelInfo } = useMemo(() => { - const result = normalizeApiConfiguration(apiConfiguration) + const result = normalizeApiConfiguration(apiConfiguration, pearAiModels) if (result.selectedProvider === "pearai") { return { ...result, @@ -1503,7 +1503,10 @@ export function getOpenRouterAuthUrl(uriScheme?: string) { return `https://openrouter.ai/auth?callback_url=${uriScheme || "vscode"}://rooveterinaryinc.roo-cline/openrouter` } -export function normalizeApiConfiguration(apiConfiguration?: ApiConfiguration) { +export function normalizeApiConfiguration( + apiConfiguration?: ApiConfiguration, + pearAiModelsQuery?: Record, +) { const provider = apiConfiguration?.apiProvider || "anthropic" const modelId = apiConfiguration?.apiModelId @@ -1591,7 +1594,7 @@ export function normalizeApiConfiguration(apiConfiguration?: ApiConfiguration) { }, } case "pearai": { - return getProviderData(pearAiModels, pearAiDefaultModelId) + return getProviderData(pearAiModelsQuery || pearAiModels, pearAiDefaultModelId) } default: return getProviderData(anthropicModels, anthropicDefaultModelId) From 857e30d0ca291e915226bc1bf926bcae5824e9e3 Mon Sep 17 00:00:00 2001 From: nang-dev Date: Fri, 7 Mar 2025 18:00:46 -0500 Subject: [PATCH 3/3] Added naming --- .../__snapshots__/system.test.ts.snap | 30 +++++++++---------- src/core/prompts/sections/modes.ts | 2 +- src/shared/__tests__/modes.test.ts | 4 +-- src/shared/modes.ts | 8 ++--- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap b/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap index b8050adb77a..01fd95303e8 100644 --- a/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap +++ b/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`SYSTEM_PROMPT should exclude diff strategy tool description when diffEnabled is false 1`] = ` -"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. +"You are PearAI Agent (Powered by Roo Code / Cline), a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. ==== @@ -324,7 +324,7 @@ Mock generic rules" `; exports[`SYSTEM_PROMPT should exclude diff strategy tool description when diffEnabled is undefined 1`] = ` -"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. +"You are PearAI Agent (Powered by Roo Code / Cline), a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. ==== @@ -647,7 +647,7 @@ Mock generic rules" `; exports[`SYSTEM_PROMPT should explicitly handle undefined mcpHub 1`] = ` -"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. +"You are PearAI Agent (Powered by Roo Code / Cline), a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. ==== @@ -970,7 +970,7 @@ Mock generic rules" `; exports[`SYSTEM_PROMPT should handle different browser viewport sizes 1`] = ` -"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. +"You are PearAI Agent (Powered by Roo Code / Cline), a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. ==== @@ -1342,7 +1342,7 @@ Mock generic rules" `; exports[`SYSTEM_PROMPT should include MCP server info when mcpHub is provided 1`] = ` -"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. +"You are PearAI Agent (Powered by Roo Code / Cline), a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. ==== @@ -1751,7 +1751,7 @@ class WeatherServer { this.setupResourceHandlers(); this.setupToolHandlers(); - + // Error handling this.server.onerror = (error) => console.error('[MCP Error]', error); process.on('SIGINT', async () => { @@ -2078,7 +2078,7 @@ Mock generic rules" `; exports[`SYSTEM_PROMPT should include browser actions when supportsComputerUse is true 1`] = ` -"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. +"You are PearAI Agent (Powered by Roo Code / Cline), a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. ==== @@ -2450,7 +2450,7 @@ Mock generic rules" `; exports[`SYSTEM_PROMPT should include diff strategy tool description when diffEnabled is true 1`] = ` -"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. +"You are PearAI Agent (Powered by Roo Code / Cline), a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. ==== @@ -2835,7 +2835,7 @@ Mock generic rules" `; exports[`SYSTEM_PROMPT should maintain consistent system prompt 1`] = ` -"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. +"You are PearAI Agent (Powered by Roo Code / Cline), a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. ==== @@ -3200,7 +3200,7 @@ Mock generic rules" `; exports[`addCustomInstructions should exclude MCP server creation info when disabled 1`] = ` -"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. +"You are PearAI Agent (Powered by Roo Code / Cline), a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. ==== @@ -3597,7 +3597,7 @@ Mock generic rules" `; exports[`addCustomInstructions should generate correct prompt for architect mode 1`] = ` -"You are Roo, an experienced technical leader who is inquisitive and an excellent planner. Your goal is to gather information and get context to create a detailed plan for accomplishing the user's task, which the user will review and approve before they switch into another mode to implement the solution. +"You are PearAI Agent (Powered by Roo Code / Cline), an experienced technical leader who is inquisitive and an excellent planner. Your goal is to gather information and get context to create a detailed plan for accomplishing the user's task, which the user will review and approve before they switch into another mode to implement the solution. ==== @@ -3911,7 +3911,7 @@ Mock generic rules" `; exports[`addCustomInstructions should generate correct prompt for ask mode 1`] = ` -"You are Roo, a knowledgeable technical assistant focused on answering questions and providing information about software development, technology, and related topics. +"You are PearAI Agent (Powered by Roo Code / Cline), a knowledgeable technical assistant focused on answering questions and providing information about software development, technology, and related topics. ==== @@ -4216,7 +4216,7 @@ Mock generic rules" `; exports[`addCustomInstructions should include MCP server creation info when enabled 1`] = ` -"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. +"You are PearAI Agent (Powered by Roo Code / Cline), a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. ==== @@ -4625,7 +4625,7 @@ class WeatherServer { this.setupResourceHandlers(); this.setupToolHandlers(); - + // Error handling this.server.onerror = (error) => console.error('[MCP Error]', error); process.on('SIGINT', async () => { @@ -5092,7 +5092,7 @@ USER'S CUSTOM INSTRUCTIONS The following additional instructions are provided by the user, and should be followed to the best of your ability without interfering with the TOOL USE guidelines. Mode-specific Instructions: - Custom mode instructions + Custom mode instructions Rules: # Rules from .clinerules-code: diff --git a/src/core/prompts/sections/modes.ts b/src/core/prompts/sections/modes.ts index f3863870dbc..0e51342278a 100644 --- a/src/core/prompts/sections/modes.ts +++ b/src/core/prompts/sections/modes.ts @@ -42,7 +42,7 @@ Both files should follow this structure: { "slug": "designer", // Required: unique slug with lowercase letters, numbers, and hyphens "name": "Designer", // Required: mode display name - "roleDefinition": "You are Roo, a UI/UX expert specializing in design systems and frontend development. Your expertise includes:\\n- Creating and maintaining design systems\\n- Implementing responsive and accessible web interfaces\\n- Working with CSS, HTML, and modern frontend frameworks\\n- Ensuring consistent user experiences across platforms", // Required: non-empty + "roleDefinition": "You are PearAI Agent (Powered by Roo Code / Cline), a UI/UX expert specializing in design systems and frontend development. Your expertise includes:\\n- Creating and maintaining design systems\\n- Implementing responsive and accessible web interfaces\\n- Working with CSS, HTML, and modern frontend frameworks\\n- Ensuring consistent user experiences across platforms", // Required: non-empty "groups": [ // Required: array of tool groups (can be empty) "read", // Read files group (read_file, search_files, list_files, list_code_definition_names) "edit", // Edit files group (apply_diff, write_to_file) - allows editing any file diff --git a/src/shared/__tests__/modes.test.ts b/src/shared/__tests__/modes.test.ts index 3bd89c4ecb5..5058dd6778f 100644 --- a/src/shared/__tests__/modes.test.ts +++ b/src/shared/__tests__/modes.test.ts @@ -341,7 +341,7 @@ describe("FileRestrictionError", () => { slug: "debug", name: "Debug", roleDefinition: - "You are Roo, an expert software debugger specializing in systematic problem diagnosis and resolution.", + "You are PearAI Agent (Powered by Roo Code / Cline), an expert software debugger specializing in systematic problem diagnosis and resolution.", groups: ["read", "edit", "browser", "command", "mcp"], }) expect(debugMode?.customInstructions).toContain( @@ -362,7 +362,7 @@ describe("FileRestrictionError", () => { slug: "debug", name: "Debug", roleDefinition: - "You are Roo, an expert software debugger specializing in systematic problem diagnosis and resolution.", + "You are PearAI Agent (Powered by Roo Code / Cline), an expert software debugger specializing in systematic problem diagnosis and resolution.", }) }) diff --git a/src/shared/modes.ts b/src/shared/modes.ts index ceb1e3e11fe..f7d3a3be3b7 100644 --- a/src/shared/modes.ts +++ b/src/shared/modes.ts @@ -78,14 +78,14 @@ export const modes: readonly ModeConfig[] = [ slug: "code", name: "Code", roleDefinition: - "You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.", + "You are PearAI Agent (Powered by Roo Code / Cline), a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.", groups: ["read", "edit", "browser", "command", "mcp"], }, { slug: "architect", name: "Architect", roleDefinition: - "You are Roo, an experienced technical leader who is inquisitive and an excellent planner. Your goal is to gather information and get context to create a detailed plan for accomplishing the user's task, which the user will review and approve before they switch into another mode to implement the solution.", + "You are PearAI Agent (Powered by Roo Code / Cline), an experienced technical leader who is inquisitive and an excellent planner. Your goal is to gather information and get context to create a detailed plan for accomplishing the user's task, which the user will review and approve before they switch into another mode to implement the solution.", groups: ["read", ["edit", { fileRegex: "\\.md$", description: "Markdown files only" }], "browser", "mcp"], customInstructions: "Depending on the user's request, you may need to do some information gathering (for example using read_file or search_files) to get more context about the task. You may also ask the user clarifying questions to get a better understanding of the task. Once you've gained more context about the user's request, you should create a detailed plan for how to accomplish the task. (You can write the plan to a markdown file if it seems appropriate.)\n\nThen you might ask the user if they are pleased with this plan, or if they would like to make any changes. Think of this as a brainstorming session where you can discuss the task and plan the best way to accomplish it. Finally once it seems like you've reached a good plan, use the switch_mode tool to request that the user switch to another mode to implement the solution.", @@ -94,7 +94,7 @@ export const modes: readonly ModeConfig[] = [ slug: "ask", name: "Ask", roleDefinition: - "You are Roo, a knowledgeable technical assistant focused on answering questions and providing information about software development, technology, and related topics.", + "You are PearAI Agent (Powered by Roo Code / Cline), a knowledgeable technical assistant focused on answering questions and providing information about software development, technology, and related topics.", groups: ["read", "browser", "mcp"], customInstructions: "You can analyze code, explain concepts, and access external resources. Make sure to answer the user's questions and don't rush to switch to implementing code.", @@ -103,7 +103,7 @@ export const modes: readonly ModeConfig[] = [ slug: "debug", name: "Debug", roleDefinition: - "You are Roo, an expert software debugger specializing in systematic problem diagnosis and resolution.", + "You are PearAI Agent (Powered by Roo Code / Cline), an expert software debugger specializing in systematic problem diagnosis and resolution.", groups: ["read", "edit", "browser", "command", "mcp"], customInstructions: "Reflect on 5-7 different possible sources of the problem, distill those down to 1-2 most likely sources, and then add logs to validate your assumptions. Explicitly ask the user to confirm the diagnosis before fixing the problem.",