Skip to content

Commit 1b86f50

Browse files
authored
Merge pull request #25 from trypear/pearai-switch
Pearai model info
2 parents d7950fc + 857e30d commit 1b86f50

File tree

7 files changed

+41
-27
lines changed

7 files changed

+41
-27
lines changed

src/api/providers/pearai.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ export class PearAiHandler {
108108
id: baseModel.id,
109109
info: {
110110
...baseModel.info,
111+
// Inherit all capabilities from the underlying model
112+
supportsImages: baseModel.info.supportsImages,
113+
supportsComputerUse: baseModel.info.supportsComputerUse,
114+
supportsPromptCache: baseModel.info.supportsPromptCache,
115+
// Apply PearAI's price markup
111116
inputPrice: (baseModel.info.inputPrice || 0) * 1.03,
112117
outputPrice: (baseModel.info.outputPrice || 0) * 1.03,
113118
cacheWritesPrice: baseModel.info.cacheWritesPrice ? baseModel.info.cacheWritesPrice * 1.03 : undefined,

src/core/prompts/__tests__/__snapshots__/system.test.ts.snap

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`SYSTEM_PROMPT should exclude diff strategy tool description when diffEnabled is false 1`] = `
4-
"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
4+
"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.
55
66
====
77
@@ -324,7 +324,7 @@ Mock generic rules"
324324
`;
325325
326326
exports[`SYSTEM_PROMPT should exclude diff strategy tool description when diffEnabled is undefined 1`] = `
327-
"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
327+
"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.
328328
329329
====
330330
@@ -647,7 +647,7 @@ Mock generic rules"
647647
`;
648648
649649
exports[`SYSTEM_PROMPT should explicitly handle undefined mcpHub 1`] = `
650-
"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
650+
"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.
651651
652652
====
653653
@@ -970,7 +970,7 @@ Mock generic rules"
970970
`;
971971
972972
exports[`SYSTEM_PROMPT should handle different browser viewport sizes 1`] = `
973-
"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
973+
"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.
974974
975975
====
976976
@@ -1342,7 +1342,7 @@ Mock generic rules"
13421342
`;
13431343
13441344
exports[`SYSTEM_PROMPT should include MCP server info when mcpHub is provided 1`] = `
1345-
"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
1345+
"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.
13461346
13471347
====
13481348
@@ -1751,7 +1751,7 @@ class WeatherServer {
17511751
17521752
this.setupResourceHandlers();
17531753
this.setupToolHandlers();
1754-
1754+
17551755
// Error handling
17561756
this.server.onerror = (error) => console.error('[MCP Error]', error);
17571757
process.on('SIGINT', async () => {
@@ -2078,7 +2078,7 @@ Mock generic rules"
20782078
`;
20792079
20802080
exports[`SYSTEM_PROMPT should include browser actions when supportsComputerUse is true 1`] = `
2081-
"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
2081+
"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.
20822082
20832083
====
20842084
@@ -2450,7 +2450,7 @@ Mock generic rules"
24502450
`;
24512451
24522452
exports[`SYSTEM_PROMPT should include diff strategy tool description when diffEnabled is true 1`] = `
2453-
"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
2453+
"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.
24542454
24552455
====
24562456
@@ -2835,7 +2835,7 @@ Mock generic rules"
28352835
`;
28362836
28372837
exports[`SYSTEM_PROMPT should maintain consistent system prompt 1`] = `
2838-
"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
2838+
"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.
28392839
28402840
====
28412841
@@ -3200,7 +3200,7 @@ Mock generic rules"
32003200
`;
32013201
32023202
exports[`addCustomInstructions should exclude MCP server creation info when disabled 1`] = `
3203-
"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
3203+
"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.
32043204
32053205
====
32063206
@@ -3597,7 +3597,7 @@ Mock generic rules"
35973597
`;
35983598
35993599
exports[`addCustomInstructions should generate correct prompt for architect mode 1`] = `
3600-
"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.
3600+
"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.
36013601
36023602
====
36033603
@@ -3911,7 +3911,7 @@ Mock generic rules"
39113911
`;
39123912
39133913
exports[`addCustomInstructions should generate correct prompt for ask mode 1`] = `
3914-
"You are Roo, a knowledgeable technical assistant focused on answering questions and providing information about software development, technology, and related topics.
3914+
"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.
39153915
39163916
====
39173917
@@ -4216,7 +4216,7 @@ Mock generic rules"
42164216
`;
42174217
42184218
exports[`addCustomInstructions should include MCP server creation info when enabled 1`] = `
4219-
"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
4219+
"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.
42204220
42214221
====
42224222
@@ -4625,7 +4625,7 @@ class WeatherServer {
46254625
46264626
this.setupResourceHandlers();
46274627
this.setupToolHandlers();
4628-
4628+
46294629
// Error handling
46304630
this.server.onerror = (error) => console.error('[MCP Error]', error);
46314631
process.on('SIGINT', async () => {
@@ -5092,7 +5092,7 @@ USER'S CUSTOM INSTRUCTIONS
50925092
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.
50935093
50945094
Mode-specific Instructions:
5095-
Custom mode instructions
5095+
Custom mode instructions
50965096
50975097
Rules:
50985098
# Rules from .clinerules-code:

src/core/prompts/sections/modes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Both files should follow this structure:
4242
{
4343
"slug": "designer", // Required: unique slug with lowercase letters, numbers, and hyphens
4444
"name": "Designer", // Required: mode display name
45-
"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
45+
"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
4646
"groups": [ // Required: array of tool groups (can be empty)
4747
"read", // Read files group (read_file, search_files, list_files, list_code_definition_names)
4848
"edit", // Edit files group (apply_diff, write_to_file) - allows editing any file

src/shared/__tests__/modes.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ describe("FileRestrictionError", () => {
341341
slug: "debug",
342342
name: "Debug",
343343
roleDefinition:
344-
"You are Roo, an expert software debugger specializing in systematic problem diagnosis and resolution.",
344+
"You are PearAI Agent (Powered by Roo Code / Cline), an expert software debugger specializing in systematic problem diagnosis and resolution.",
345345
groups: ["read", "edit", "browser", "command", "mcp"],
346346
})
347347
expect(debugMode?.customInstructions).toContain(
@@ -362,7 +362,7 @@ describe("FileRestrictionError", () => {
362362
slug: "debug",
363363
name: "Debug",
364364
roleDefinition:
365-
"You are Roo, an expert software debugger specializing in systematic problem diagnosis and resolution.",
365+
"You are PearAI Agent (Powered by Roo Code / Cline), an expert software debugger specializing in systematic problem diagnosis and resolution.",
366366
})
367367
})
368368

src/shared/api.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,8 +802,11 @@ export const pearAiDefaultModelId: PearAiModelId = "pearai-model"
802802
export const pearAiDefaultModelInfo: ModelInfo = {
803803
maxTokens: 8192,
804804
contextWindow: 64000,
805-
supportsImages: false,
805+
// Default values for required fields, but actual values will be inherited from underlying model
806806
supportsPromptCache: true,
807+
supportsImages: false,
808+
supportsComputerUse: false,
809+
// Base pricing
807810
inputPrice: 0.014,
808811
outputPrice: 0.28,
809812
cacheWritesPrice: 0.27,
@@ -816,8 +819,11 @@ export const pearAiModels = {
816819
"pearai-model": {
817820
maxTokens: 8192,
818821
contextWindow: 64000,
819-
supportsImages: false,
822+
// Default values for required fields, but actual values will be inherited from underlying model
820823
supportsPromptCache: true,
824+
supportsImages: false,
825+
supportsComputerUse: false,
826+
// Base pricing
821827
inputPrice: 0.014,
822828
outputPrice: 0.28,
823829
cacheWritesPrice: 0.27,

src/shared/modes.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ export const modes: readonly ModeConfig[] = [
7878
slug: "code",
7979
name: "Code",
8080
roleDefinition:
81-
"You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.",
81+
"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.",
8282
groups: ["read", "edit", "browser", "command", "mcp"],
8383
},
8484
{
8585
slug: "architect",
8686
name: "Architect",
8787
roleDefinition:
88-
"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.",
88+
"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.",
8989
groups: ["read", ["edit", { fileRegex: "\\.md$", description: "Markdown files only" }], "browser", "mcp"],
9090
customInstructions:
9191
"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[] = [
9494
slug: "ask",
9595
name: "Ask",
9696
roleDefinition:
97-
"You are Roo, a knowledgeable technical assistant focused on answering questions and providing information about software development, technology, and related topics.",
97+
"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.",
9898
groups: ["read", "browser", "mcp"],
9999
customInstructions:
100100
"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[] = [
103103
slug: "debug",
104104
name: "Debug",
105105
roleDefinition:
106-
"You are Roo, an expert software debugger specializing in systematic problem diagnosis and resolution.",
106+
"You are PearAI Agent (Powered by Roo Code / Cline), an expert software debugger specializing in systematic problem diagnosis and resolution.",
107107
groups: ["read", "edit", "browser", "command", "mcp"],
108108
customInstructions:
109109
"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.",

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const ApiOptions = ({
118118
)
119119

120120
const { selectedProvider, selectedModelId, selectedModelInfo } = useMemo(() => {
121-
const result = normalizeApiConfiguration(apiConfiguration)
121+
const result = normalizeApiConfiguration(apiConfiguration, pearAiModels)
122122
if (result.selectedProvider === "pearai") {
123123
return {
124124
...result,
@@ -1503,7 +1503,10 @@ export function getOpenRouterAuthUrl(uriScheme?: string) {
15031503
return `https://openrouter.ai/auth?callback_url=${uriScheme || "vscode"}://rooveterinaryinc.roo-cline/openrouter`
15041504
}
15051505

1506-
export function normalizeApiConfiguration(apiConfiguration?: ApiConfiguration) {
1506+
export function normalizeApiConfiguration(
1507+
apiConfiguration?: ApiConfiguration,
1508+
pearAiModelsQuery?: Record<string, ModelInfo>,
1509+
) {
15071510
const provider = apiConfiguration?.apiProvider || "anthropic"
15081511
const modelId = apiConfiguration?.apiModelId
15091512

@@ -1591,7 +1594,7 @@ export function normalizeApiConfiguration(apiConfiguration?: ApiConfiguration) {
15911594
},
15921595
}
15931596
case "pearai": {
1594-
return getProviderData(pearAiModels, pearAiDefaultModelId)
1597+
return getProviderData(pearAiModelsQuery || pearAiModels, pearAiDefaultModelId)
15951598
}
15961599
default:
15971600
return getProviderData(anthropicModels, anthropicDefaultModelId)

0 commit comments

Comments
 (0)