File size: 1,756 Bytes
2609ce2
 
 
c3b2c76
ee6f83c
 
c3b2c76
2609ce2
 
 
ee6f83c
2609ce2
 
c3b2c76
2609ce2
 
 
 
 
 
c3b2c76
 
 
 
6c0099d
c3b2c76
2609ce2
ee6f83c
 
 
2609ce2
 
 
 
c3b2c76
2faeeb0
 
 
c3b2c76
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
set -e

echo "[entrypoint] OpenClaw HuggingFace Spaces Entrypoint"
echo "[entrypoint] ======================================="

# DNS pre-resolution for WhatsApp
echo "[entrypoint] Resolving WhatsApp domains via DNS-over-HTTPS..."
python3 /home/node/scripts/dns-resolve.py /tmp/dns-resolved.json || echo "[entrypoint] DNS pre-resolve had issues (non-fatal)"

# Enable Node.js DNS fix
export NODE_OPTIONS="${NODE_OPTIONS:+$NODE_OPTIONS }--require /home/node/scripts/dns-fix.cjs"

# Ensure extensions symlink exists
if [ ! -L /home/node/.openclaw/extensions ]; then
  rm -rf /home/node/.openclaw/extensions 2>/dev/null || true
  ln -s /app/openclaw/extensions /home/node/.openclaw/extensions
  echo "[entrypoint] Created extensions symlink -> /app/openclaw/extensions"
fi

# Check for WhatsApp credentials
if [ -d /home/node/.openclaw/credentials/whatsapp ]; then
  echo "[entrypoint] Found existing WhatsApp credentials - will use for auto-connect"
fi

# Build artifacts check
cd /app/openclaw
echo "[entrypoint] Build artifacts check:"
test -f dist/entry.js && echo "  OK dist/entry.js" || echo "  WARNING: dist/entry.js missing!"
test -f dist/plugin-sdk/index.js && echo "  OK dist/plugin-sdk/index.js" || echo "  WARNING: dist/plugin-sdk/index.js missing!"
echo "  Extensions: $(ls extensions/ 2>/dev/null | wc -l | tr -d ' ') found"
echo "  Global extensions link: $(readlink /home/node/.openclaw/extensions 2>/dev/null || echo 'NOT SET')"
echo "  DNS resolved: $(cat /tmp/dns-resolved.json 2>/dev/null || echo 'file missing')"

# Create logs directory
mkdir -p /home/node/logs
touch /home/node/logs/app.log

# Start OpenClaw via sync_hf.py
echo "[entrypoint] Starting OpenClaw via sync_hf.py..."
exec python3 -u /home/node/scripts/sync_hf.py