-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat: sync extension bridge settings with cloud #7535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,7 +128,36 @@ export async function activate(context: vscode.ExtensionContext) { | |
| // Initialize Roo Code Cloud service. | ||
| const postStateListener = () => ClineProvider.getVisibleInstance()?.postStateToWebview() | ||
| authStateChangedHandler = postStateListener | ||
| settingsUpdatedHandler = postStateListener | ||
|
|
||
| settingsUpdatedHandler = async () => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding JSDoc comments to document this enhanced settings handler's functionality, especially since it now handles BridgeOrchestrator updates in addition to posting state. |
||
| const userInfo = CloudService.instance.getUserInfo() | ||
| if (userInfo && CloudService.instance.cloudAPI) { | ||
| try { | ||
| const config = await CloudService.instance.cloudAPI.bridgeConfig() | ||
|
|
||
| const isCloudAgent = | ||
| typeof process.env.ROO_CODE_CLOUD_TOKEN === "string" && process.env.ROO_CODE_CLOUD_TOKEN.length > 0 | ||
|
|
||
| const remoteControlEnabled = isCloudAgent | ||
| ? true | ||
| : (CloudService.instance.getUserSettings()?.settings?.extensionBridgeEnabled ?? false) | ||
|
|
||
| cloudLogger(`[CloudService] Settings updated - remoteControlEnabled = ${remoteControlEnabled}`) | ||
|
|
||
| await BridgeOrchestrator.connectOrDisconnect(userInfo, remoteControlEnabled, { | ||
| ...config, | ||
| provider, | ||
| sessionId: vscode.env.sessionId, | ||
| }) | ||
| } catch (error) { | ||
| cloudLogger( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it intentional that we're not notifying the user when BridgeOrchestrator update fails? The error is logged but users might want to know if their remote control connection has issues. |
||
| `[CloudService] Failed to update BridgeOrchestrator on settings change: ${error instanceof Error ? error.message : String(error)}`, | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| postStateListener() | ||
| } | ||
|
|
||
| userInfoHandler = async ({ userInfo }: { userInfo: CloudUserInfo }) => { | ||
| postStateListener() | ||
|
|
@@ -146,11 +175,15 @@ export async function activate(context: vscode.ExtensionContext) { | |
|
|
||
| cloudLogger(`[CloudService] isCloudAgent = ${isCloudAgent}, socketBridgeUrl = ${config.socketBridgeUrl}`) | ||
|
|
||
| await BridgeOrchestrator.connectOrDisconnect( | ||
| userInfo, | ||
| isCloudAgent ? true : contextProxy.getValue("remoteControlEnabled"), | ||
| { ...config, provider, sessionId: vscode.env.sessionId }, | ||
| ) | ||
| const remoteControlEnabled = isCloudAgent | ||
| ? true | ||
| : (CloudService.instance.getUserSettings()?.settings?.extensionBridgeEnabled ?? false) | ||
|
|
||
| await BridgeOrchestrator.connectOrDisconnect(userInfo, remoteControlEnabled, { | ||
| ...config, | ||
| provider, | ||
| sessionId: vscode.env.sessionId, | ||
| }) | ||
| } catch (error) { | ||
| cloudLogger( | ||
| `[CloudService] Failed to fetch bridgeConfig: ${error instanceof Error ? error.message : String(error)}`, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the cloud settings update fails, we're only logging the error. Should we also show a user-facing notification so they know their setting change didn't persist?