Compare commits

...
Author SHA1 Message Date
Sarah Fortune a6a86c9c86 Don't instantiate the AuthService at the top level of the module.
I am working separating the initialization for the extension and cline-core
and this is causing a circular dependency.
2025-08-08 14:12:08 +01:00
3 changed files with 14 additions and 9 deletions
@@ -2,8 +2,6 @@ import { Controller } from "../index"
import { AuthService } from "@/services/auth/AuthService"
import { EmptyRequest, String } from "@shared/proto/cline/common"
const authService = AuthService.getInstance()
/**
* Handles the user clicking the login link in the UI.
* Generates a secure nonce for state validation, stores it in secrets,
@@ -13,5 +11,5 @@ const authService = AuthService.getInstance()
* @returns The login URL as a string.
*/
export async function accountLoginClicked(_controller: Controller, _: EmptyRequest): Promise<String> {
return await authService.createAuthRequest()
return await AuthService.getInstance().createAuthRequest()
}
@@ -3,7 +3,6 @@ import { Empty } from "@shared/proto/cline/common"
import type { EmptyRequest } from "@shared/proto/cline/common"
import type { Controller } from "../index"
const authService = AuthService.getInstance()
/**
* Handles the account logout action
* @param controller The controller instance
@@ -12,6 +11,6 @@ const authService = AuthService.getInstance()
*/
export async function accountLogoutClicked(controller: Controller, _request: EmptyRequest): Promise<Empty> {
await controller.handleSignOut()
await authService.handleDeauth()
await AuthService.getInstance().handleDeauth()
return Empty.create({})
}
@@ -1,5 +1,13 @@
import { AuthService } from "../../../services/auth/AuthService"
import { AuthState, EmptyRequest } from "@/shared/proto/index.cline"
import { AuthService } from "@services/auth/AuthService"
import { Controller } from ".."
import { StreamingResponseHandler } from "../grpc-handler"
const authService = AuthService.getInstance()
export const subscribeToAuthStatusUpdate = authService.subscribeToAuthStatusUpdate.bind(authService)
export const sendAuthStatusUpdateEvent = authService.sendAuthStatusUpdate.bind(authService)
export async function subscribeToAuthStatusUpdate(
controller: Controller,
request: EmptyRequest,
responseStream: StreamingResponseHandler<AuthState>,
requestId?: string,
): Promise<void> {
return AuthService.getInstance().subscribeToAuthStatusUpdate(controller, request, responseStream, requestId)
}