Skip to content

Commit 3b565a1

Browse files
committed
Progress
1 parent 1c7ee46 commit 3b565a1

4 files changed

Lines changed: 26 additions & 1 deletion

File tree

src/api/providers/pearai.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export class PearAiHandler extends BaseProvider implements SingleCompletionHandl
3535
}
3636
})
3737
throw new Error("PearAI API key not found. Please login to PearAI.")
38+
} else {
39+
vscode.commands.executeCommand("pearai.checkPearAITokens", undefined)
3840
}
3941

4042
this.handler = new OpenRouterHandler({

src/core/webview/ClineProvider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
565565

566566
private async getHMRHtmlContent(webview: vscode.Webview): Promise<string> {
567567
const localPort = "5173"
568+
// const localPort = "5174" for devving at the same time as submodule
568569
const localServerUrl = `localhost:${localPort}`
569570

570571
// Check if local dev server is running.

src/extension.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,28 @@ export function activate(context: vscode.ExtensionContext) {
112112
}),
113113
)
114114

115+
context.subscriptions.push(
116+
vscode.commands.registerCommand("pearai-roo-cline.updatePearAITokens", async (data) => {
117+
console.dir("Updated PearAI tokens:")
118+
console.dir(data)
119+
context.secrets.store("pearaiApiKey", data.accessToken)
120+
context.secrets.store("pearaiRefreshKey", data.refreshToken)
121+
const provider = await ClineProvider.getInstance()
122+
if (provider) {
123+
// Update the API configuration to clear the PearAI key
124+
await provider.setValues({
125+
pearaiApiKey: data.accessToken,
126+
})
127+
await provider.postStateToWebview()
128+
// Update MCP server with new token
129+
const mcpHub = provider.getMcpHub()
130+
if (mcpHub) {
131+
await mcpHub.updatePearAiApiKey(data.accessToken)
132+
}
133+
}
134+
}),
135+
)
136+
115137
context.subscriptions.push(
116138
vscode.commands.registerCommand("pearai-roo-cline.pearaiLogout", async () => {
117139
console.dir("Logged out of PearAI:")

src/services/mcp/McpHub.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ export class McpHub {
10431043

10441044
await fs.writeFile(settingsPath, JSON.stringify(config, null, 2))
10451045
await this.updateServerConnections(config.mcpServers)
1046-
vscode.window.showInformationMessage("PearAI API key updated successfully")
1046+
// vscode.window.showInformationMessage("PearAI API key updated successfully")
10471047
}
10481048
} catch (error) {
10491049
console.error("Failed to update PearAI API key:", error)

0 commit comments

Comments
 (0)