fix: authenticate desktop agent websocket

This commit is contained in:
Simos Mikelatos
2026-06-19 15:52:23 +00:00
parent f150fa6b09
commit 077baee5f2
4 changed files with 19 additions and 8 deletions

View File

@@ -42,6 +42,7 @@ const RECONNECT_MAX_MS = 30_000;
const consentMode: ConsentMode = process.env.CLOUDCLI_COMPUTER_USE_CONSENT_MODE === 'auto' ? 'auto' : 'ask';
const agentLabel = process.env.CLOUDCLI_DESKTOP_AGENT_LABEL || 'cloudcli-desktop';
const desktopAgentApiKey = process.env.CLOUDCLI_DESKTOP_AGENT_API_KEY || '';
function parseTargets(): string[] {
const raw =
@@ -195,9 +196,7 @@ function connect(url: string): void {
const open = () => {
socket = new WebSocket(url, {
headers: process.env.CLOUDCLI_DESKTOP_AGENT_TOKEN
? { 'x-cloudcli-agent-token': process.env.CLOUDCLI_DESKTOP_AGENT_TOKEN }
: undefined,
headers: desktopAgentApiKey ? { 'X-API-Key': desktopAgentApiKey } : undefined,
});
socket.on('open', () => {