Skip to content

Commit af00c62

Browse files
ctehannesrudolph
authored andcommitted
Move @roo-code/cloud to the Roo-Code repo (#7503)
1 parent 8d94af5 commit af00c62

File tree

20 files changed

+1727
-1026
lines changed

20 files changed

+1727
-1026
lines changed

packages/cloud/src/WebAuthService.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
129129
private changeState(newState: AuthState): void {
130130
const previousState = this.state
131131
this.state = newState
132-
this.log(`[auth] changeState: ${previousState} -> ${newState}`)
133132
this.emit("auth-state-changed", { state: newState, previousState })
134133
}
135134

@@ -163,6 +162,8 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
163162
this.userInfo = null
164163

165164
this.changeState("logged-out")
165+
166+
this.log("[auth] Transitioned to logged-out state")
166167
}
167168

168169
private transitionToAttemptingSession(credentials: AuthCredentials): void {
@@ -175,13 +176,17 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
175176
this.changeState("attempting-session")
176177

177178
this.timer.start()
179+
180+
this.log("[auth] Transitioned to attempting-session state")
178181
}
179182

180183
private transitionToInactiveSession(): void {
181184
this.sessionToken = null
182185
this.userInfo = null
183186

184187
this.changeState("inactive-session")
188+
189+
this.log("[auth] Transitioned to inactive-session state")
185190
}
186191

187192
/**
@@ -417,6 +422,7 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
417422

418423
if (previousState !== "active-session") {
419424
this.changeState("active-session")
425+
this.log("[auth] Transitioned to active-session state")
420426
this.fetchUserInfo()
421427
} else {
422428
this.state = "active-session"
@@ -563,7 +569,11 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
563569
)?.email_address
564570
}
565571

566-
let extensionBridgeEnabled = true
572+
// Check for extension_bridge_enabled in user's public metadata
573+
let extensionBridgeEnabled = false
574+
if (userData.public_metadata?.extension_bridge_enabled === true) {
575+
extensionBridgeEnabled = true
576+
}
567577

568578
// Fetch organization info if user is in organization context
569579
try {
@@ -579,7 +589,11 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
579589
if (userMembership) {
580590
this.setUserOrganizationInfo(userInfo, userMembership)
581591

582-
extensionBridgeEnabled = await this.isExtensionBridgeEnabledForOrganization(storedOrgId)
592+
// Check organization public metadata for extension_bridge_enabled
593+
// Organization setting takes precedence over user setting
594+
if (await this.isExtensionBridgeEnabledForOrganization(storedOrgId)) {
595+
extensionBridgeEnabled = true
596+
}
583597

584598
this.log("[auth] User in organization context:", {
585599
id: userMembership.organization.id,
@@ -600,9 +614,10 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
600614
if (primaryOrgMembership) {
601615
this.setUserOrganizationInfo(userInfo, primaryOrgMembership)
602616

603-
extensionBridgeEnabled = await this.isExtensionBridgeEnabledForOrganization(
604-
primaryOrgMembership.organization.id,
605-
)
617+
// Check organization public metadata for extension_bridge_enabled
618+
if (await this.isExtensionBridgeEnabledForOrganization(primaryOrgMembership.organization.id)) {
619+
extensionBridgeEnabled = true
620+
}
606621

607622
this.log("[auth] Legacy credentials: Found organization membership:", {
608623
id: primaryOrgMembership.organization.id,

packages/cloud/src/__mocks__/vscode.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ export const Uri = {
1313
parse: vi.fn((uri: string) => ({ toString: () => uri })),
1414
}
1515

16-
export const commands = {
17-
executeCommand: vi.fn().mockResolvedValue(undefined),
18-
}
19-
2016
export interface ExtensionContext {
2117
secrets: {
2218
get: (key: string) => Promise<string | undefined>

packages/cloud/src/__tests__/WebAuthService.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ describe("WebAuthService", () => {
560560
name: "John Doe",
561561
562562
picture: "https://example.com/avatar.jpg",
563-
extensionBridgeEnabled: true,
563+
extensionBridgeEnabled: false,
564564
},
565565
})
566566
})
@@ -725,7 +725,7 @@ describe("WebAuthService", () => {
725725
name: "Jane Smith",
726726
727727
picture: "https://example.com/jane.jpg",
728-
extensionBridgeEnabled: true,
728+
extensionBridgeEnabled: false,
729729
})
730730
})
731731

@@ -844,7 +844,7 @@ describe("WebAuthService", () => {
844844
name: "John Doe",
845845
email: undefined,
846846
picture: undefined,
847-
extensionBridgeEnabled: true,
847+
extensionBridgeEnabled: false,
848848
})
849849
})
850850
})
@@ -969,7 +969,7 @@ describe("WebAuthService", () => {
969969
name: "Test User",
970970
email: undefined,
971971
picture: undefined,
972-
extensionBridgeEnabled: true,
972+
extensionBridgeEnabled: false,
973973
},
974974
})
975975
})

0 commit comments

Comments
 (0)