diff --git a/README.md b/README.md index ec6872e..1117c60 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ Once your merge is successful:
-Download on VS Marketplace +Download on VS Marketplace Join the Discord diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 4d8706b..0518bac 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1273,6 +1273,33 @@ export class ClineProvider implements vscode.WebviewViewProvider { return cacheDir } + async handleGlamaCallback(code: string) { + let apiKey: string + try { + const response = await axios.post("https://glama.ai/api/gateway/v1/auth/exchange-code", { code }) + if (response.data && response.data.apiKey) { + apiKey = response.data.apiKey + } else { + throw new Error("Invalid response from Glama API") + } + } catch (error) { + console.error("Error exchanging code for API key:", error) + throw error + } + + const glama: ApiProvider = "glama" + await this.updateGlobalState("apiProvider", glama) + await this.storeSecret("glamaApiKey", apiKey) + await this.postStateToWebview() + if (this.cline) { + this.cline.api = buildApiHandler({ + apiProvider: glama, + glamaApiKey: apiKey, + }) + } + // await this.postMessageToWebview({ type: "action", action: "settingsButtonClicked" }) // bad ux if user is on welcome + } + async readGlamaModels(): Promise | undefined> { const glamaModelsFilePath = path.join( await this.ensureCacheDirectoryExists(), diff --git a/src/exports/README.md b/src/exports/README.md index 40f909a..03b8983 100644 --- a/src/exports/README.md +++ b/src/exports/README.md @@ -7,7 +7,7 @@ The Cline extension exposes an API that can be used by other extensions. To use 3. Get access to the API with the following code: ```ts - const clineExtension = vscode.extensions.getExtension("saoudrizwan.claude-dev") + const clineExtension = vscode.extensions.getExtension("rooveterinaryinc.roo-cline") if (!clineExtension?.isActive) { throw new Error("Cline extension is not activated") @@ -44,11 +44,11 @@ The Cline extension exposes an API that can be used by other extensions. To use } ``` - **Note:** To ensure that the `saoudrizwan.claude-dev` extension is activated before your extension, add it to the `extensionDependencies` in your `package.json`: + **Note:** To ensure that the `rooveterinaryinc.roo-cline` extension is activated before your extension, add it to the `extensionDependencies` in your `package.json`: ```json "extensionDependencies": [ - "saoudrizwan.claude-dev" + "rooveterinaryinc.roo-cline" ] ``` diff --git a/src/extension.ts b/src/extension.ts index c6dd9c2..31ba8a7 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -139,6 +139,14 @@ export function activate(context: vscode.ExtensionContext) { return } switch (path) { + case "/glama": { + const code = query.get("code") + if (code) { + await visibleProvider.handleGlamaCallback(code) + } + break + } + case "/openrouter": { const code = query.get("code") if (code) { diff --git a/src/integrations/theme/getTheme.ts b/src/integrations/theme/getTheme.ts index ffed26e..dbc7a0f 100644 --- a/src/integrations/theme/getTheme.ts +++ b/src/integrations/theme/getTheme.ts @@ -141,5 +141,5 @@ export function mergeJson( } function getExtensionUri(): vscode.Uri { - return vscode.extensions.getExtension("saoudrizwan.claude-dev")!.extensionUri + return vscode.extensions.getExtension("rooveterinaryinc.roo-cline")!.extensionUri } diff --git a/webview-ui/src/components/settings/ApiOptions.tsx b/webview-ui/src/components/settings/ApiOptions.tsx index cc30ae9..4f5d6e2 100644 --- a/webview-ui/src/components/settings/ApiOptions.tsx +++ b/webview-ui/src/components/settings/ApiOptions.tsx @@ -209,11 +209,12 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) = Glama API Key {!apiConfiguration?.glamaApiKey && ( - - You can get an Glama API key by signing up here. - + + Get Glama API Key + )}

{