Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,20 @@ export async function activate(context: vscode.ExtensionContext) {
try {
const config = await CloudService.instance.cloudAPI.bridgeConfig()

const isCloudAgent =
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting this cloud agent detection logic into a utility function for better reusability and testability. For example:

You could add a new function in src/utils/remoteControl.ts or a similar utility file:

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a comment explaining what constitutes a cloud agent for future maintainers:

typeof process.env.ROO_CODE_CLOUD_TOKEN === "string" && process.env.ROO_CODE_CLOUD_TOKEN.length > 0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security consideration: The current check only validates that ROO_CODE_CLOUD_TOKEN exists and has length > 0, but doesn't validate if it's actually a valid token. Could someone potentially exploit this by setting a dummy value to force remote control enabled? Consider adding token validation or documenting why this simple check is sufficient for security.


cloudLogger(`[CloudService] isCloudAgent = ${isCloudAgent}, socketBridgeUrl = ${config.socketBridgeUrl}`)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good improvement using cloudLogger for consistency! This will help with debugging cloud-related issues.


ExtensionBridgeService.handleRemoteControlState(
userInfo,
contextProxy.getValue("remoteControlEnabled"),
{ ...config, provider, sessionId: vscode.env.sessionId },
(message: string) => outputChannel.appendLine(message),
isCloudAgent ? true : contextProxy.getValue("remoteControlEnabled"),
{
...config,
provider,
sessionId: vscode.env.sessionId,
},
cloudLogger,
)
} catch (error) {
cloudLogger(
Expand Down
Loading