Roo-Code/packages/cloud/src/StaticTokenAuthService.ts
roomote[bot] d00f1a2bb8
feat: remove Roomote Control from extension (#11271)
* feat: remove Roomote Control from extension

Remove all Roomote Control (remote control) functionality:

- Remove BridgeOrchestrator and entire bridge directory from @roo-code/cloud
- Remove remoteControlEnabled, featureRoomoteControlEnabled from extension state
- Remove extensionBridgeEnabled from CloudUserInfo and user settings
- Remove roomoteControlEnabled from organization/user feature schemas
- Remove enableBridge from Task and ClineProvider
- Remove remote control toggle from CloudView UI
- Remove remoteControlEnabled message handler
- Remove extension bridge disconnect on logout/deactivate
- Update CloudTaskButton to show for all logged-in users
- Remove remote control translation strings from all locales
- Update all related tests

CLO-765

* fix: remove dead getOrganizationMetadata and unused socket.io-client dep

* Readmes

* Readmes

* Types

* fix: remove leftover Roomote Control references from locale READMEs and stale BridgeOrchestrator mock

* Removes cloudtaskbutton

* fix: remove orphaned qrcode packages and dead openInCloud translation keys

* pnpmlock

* Revert these

* Revert these

* Revert these

* Remove socket.io

---------

Co-authored-by: Roo Code <roomote@roocode.com>
Co-authored-by: Bruno Bergher <bruno@roocode.com>
Co-authored-by: cte <cestreich@gmail.com>
2026-02-19 16:33:39 -08:00

101 lines
2.6 KiB
TypeScript

import EventEmitter from "events"
import { jwtDecode } from "jwt-decode"
import type { ExtensionContext } from "vscode"
import type { JWTPayload, CloudUserInfo, AuthService, AuthServiceEvents, AuthState } from "@roo-code/types"
export class StaticTokenAuthService extends EventEmitter<AuthServiceEvents> implements AuthService {
private state: AuthState = "active-session"
private token: string
private log: (...args: unknown[]) => void
private userInfo: CloudUserInfo
constructor(context: ExtensionContext, token: string, log?: (...args: unknown[]) => void) {
super()
this.token = token
this.log = log || console.log
this.log("[auth] Using StaticTokenAuthService")
let payload
try {
payload = jwtDecode<JWTPayload>(token)
} catch (error) {
this.log("[auth] Failed to parse JWT:", error)
}
this.userInfo = {
id: payload?.r?.u || payload?.sub || undefined,
organizationId: payload?.r?.o || undefined,
}
}
public async initialize(): Promise<void> {
this.state = "active-session"
}
public broadcast(): void {
this.emit("auth-state-changed", {
state: this.state,
previousState: "initializing",
})
this.emit("user-info", { userInfo: this.userInfo })
}
public async login(_landingPageSlug?: string, _useProviderSignup?: boolean): Promise<void> {
throw new Error("Authentication methods are disabled in StaticTokenAuthService")
}
public async logout(): Promise<void> {
throw new Error("Authentication methods are disabled in StaticTokenAuthService")
}
public async handleCallback(
_code: string | null,
_state: string | null,
_organizationId?: string | null,
_providerModel?: string | null,
): Promise<void> {
throw new Error("Authentication methods are disabled in StaticTokenAuthService")
}
public async switchOrganization(_organizationId: string | null): Promise<void> {
throw new Error("Authentication methods are disabled in StaticTokenAuthService")
}
public async getOrganizationMemberships(): Promise<import("@roo-code/types").CloudOrganizationMembership[]> {
throw new Error("Authentication methods are disabled in StaticTokenAuthService")
}
public getState(): AuthState {
return this.state
}
public getSessionToken(): string | undefined {
return this.token
}
public isAuthenticated(): boolean {
return true
}
public hasActiveSession(): boolean {
return true
}
public hasOrIsAcquiringActiveSession(): boolean {
return true
}
public getUserInfo(): CloudUserInfo | null {
return this.userInfo
}
public getStoredOrganizationId(): string | null {
return this.userInfo?.organizationId || null
}
}