Spaces:
Runtime error
Runtime error
fix: qr detection reliability and log piping
Browse filesFiles changed (2)
74 unmodified lines7576777879808182838485868774 unmodified linesecho "[entrypoint] WhatsApp login guardian started (PID $!)") &# ── 启动 QR Code Detection Manager (BLOCKING CHECK) ──# 必须在 gateway 启动之前或并行启动,监控日志中的 QR 码请求# 这里我们让它并行运行,监控文件系统和日志(sleep 10NODE_PATH=/app/openclaw/node_modules node /home/node/scripts/qr-detection-manager.cjs "${SPACE_HOST:-https://huggingface.co/spaces/tao-shen/openclaw-ai}" &echo "[entrypoint] QR Detection Manager started (PID $!)") &exec node openclaw.mjs gateway74 unmodified lines7576777879808182838485868788899091929374 unmodified linesecho "[entrypoint] WhatsApp login guardian started (PID $!)") &# Create logs directorymkdir -p /home/node/logstouch /home/node/logs/app.log# ── 启动 QR Code Detection Manager (BLOCKING CHECK) ──# 监控 logs/app.log(sleep 10# Pass the log file path explicitly if needed, or rely on defaultNODE_PATH=/app/openclaw/node_modules node /home/node/scripts/qr-detection-manager.cjs "${SPACE_HOST:-https://huggingface.co/spaces/tao-shen/openclaw-ai}" &echo "[entrypoint] QR Detection Manager started (PID $!)") &# 使用 tee 同时输出到 stdout (供 HF Logs) 和文件 (供 QR Manager)exec node openclaw.mjs gateway 2>&1 | tee -a /home/node/logs/app.log
41 unmodified lines4243444546474821 unmodified lines7071727374757658 unmodified lines13513613713813914041 unmodified linesasync connectWebSocket(spaceUrl) {try {const wsUrl = spaceUrl.replace('https://', 'wss://').replace('http://', 'ws://');const fullWsUrl = `${wsUrl}/queue/join`;this.log('info', 'Connecting to WebSocket', { url: fullWsUrl });21 unmodified linesthis.log('error', 'Failed to connect to WebSocket', { error: error.message });}}startMonitoring() {this.log('info', 'Starting QR code monitoring');58 unmodified linescheckLogsForQR() {try {const logPaths = ['./logs/output.log','./logs/app.log','./logs/whatsapp.log',41 unmodified lines42434445464748495021 unmodified lines72737475767778798081828358 unmodified lines14214314414514614714814941 unmodified linesasync connectWebSocket(spaceUrl) {try {// Handle spaceUrl being just a hostname or full URLlet host = spaceUrl.replace(/^https?:\/\//, '').replace(/\/$/, '');const wsUrl = `wss://${host}`;const fullWsUrl = `${wsUrl}/queue/join`;this.log('info', 'Connecting to WebSocket', { url: fullWsUrl });21 unmodified linesthis.log('error', 'Failed to connect to WebSocket', { error: error.message });}}handleWebSocketMessage(data) {// Placeholder for future WS message handling if needed// Currently we rely mostly on log/file monitoring}startMonitoring() {this.log('info', 'Starting QR code monitoring');58 unmodified linescheckLogsForQR() {try {const logPaths = ['/home/node/logs/app.log', // Main app log (redirected)'/home/node/logs/app.json.log', // Structured log'./logs/output.log','./logs/app.log','./logs/whatsapp.log',
scripts/entrypoint.sh+9-3
scripts/qr-detection-manager.cjs+11-2