Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat: add optional VNC password authentication (#1072)

r33drichardsfd9cdedb4466
diff --git a/docs/src/app/api/copilotkit/route.ts b/docs/src/app/api/copilotkit/route.ts
index 3554b8035b..9def45aedc 100644
--- a/docs/src/app/api/copilotkit/route.ts
+++ b/docs/src/app/api/copilotkit/route.ts
@@ -213,17 +213,18 @@ class AnthropicSafeBuiltInAgent extends BuiltInAgent {
}
run(input: any): ReturnType<BuiltInAgent['run']> {
- const filteredMessages = this.filterEmptyMessages(input.messages || []);
+ // Don't filter messages - let CopilotKit/Anthropic handle empty messages
+ const messages = input.messages || [];
const modifiedInput = {
...input,
- messages: filteredMessages,
+ messages: messages,
};
// Fix message ordering - without unique IDs, responses get merged
const uniqueMessageId = randomUUID();
const conversationId = input.threadId || uniqueMessageId;
- const userMessages = filteredMessages.filter((m: any) => m.role === 'user');
+ const userMessages = messages.filter((m: any) => m.role === 'user');
const latestUserMessage = userMessages[userMessages.length - 1];
const userPrompt = this.extractMessageContent(latestUserMessage);
@@ -241,7 +242,7 @@ class AnthropicSafeBuiltInAgent extends BuiltInAgent {
question_type: questionType,
topics,
prompt_length: userPrompt.length,
- message_count: filteredMessages.length,
+ message_count: messages.length,
conversation_id: conversationId,
timestamp: new Date().toISOString(),
},
diff --git a/libs/xfce/src/scripts/start-vnc.sh b/libs/xfce/src/scripts/start-vnc.sh
index 934e6d3c68..0079837343 100644
--- a/libs/xfce/src/scripts/start-vnc.sh
+++ b/libs/xfce/src/scripts/start-vnc.sh
@@ -4,20 +4,30 @@ set -e
# Clean up any existing VNC lock files
rm -rf /tmp/.X1-lock /tmp/.X11-unix/X1
-# Start VNC server without password authentication
+# Set up VNC authentication if VNC_PW is provided
+if [ -n "$VNC_PW" ]; then
+ mkdir -p /home/cua/.vnc
+ echo "$VNC_PW" | vncpasswd -f > /home/cua/.vnc/passwd
+ chmod 600 /home/cua/.vnc/passwd
+ SECURITY_ARGS="-SecurityTypes VncAuth -rfbauth /home/cua/.vnc/passwd"
+ unset VNC_PW
+else
+ SECURITY_ARGS="-SecurityTypes None --I-KNOW-THIS-IS-INSECURE"
+fi
+
+# Start VNC server
vncserver :1 \
-geometry ${VNC_RESOLUTION:-1920x1080} \
-depth ${VNC_COL_DEPTH:-24} \
-rfbport ${VNC_PORT:-5901} \
-localhost no \
- -SecurityTypes None \
+ $SECURITY_ARGS \
-AlwaysShared \
-AcceptPointerEvents \
-AcceptKeyEvents \
-AcceptCutText \
-SendCutText \
- -xstartup /usr/local/bin/xstartup.sh \
- --I-KNOW-THIS-IS-INSECURE
+ -xstartup /usr/local/bin/xstartup.sh
# Keep the process running
tail -f /home/cua/.vnc/*.log