#!/bin/bash set -e echo "[start] Booting picoclaw stack..." # --- SOCKS5 Bridge (replaces chisel) --- # Local SOCKS5 proxy on :1080, forwards via HTTP CONNECT to tinyproxy CF tunnel UPSTREAM_PROXY="${UPSTREAM_PROXY:-https://relying-technology-word-talented.trycloudflare.com}" export UPSTREAM_PROXY python3 /app/socks5_bridge.py > /tmp/socks5_bridge.log 2>&1 & echo "[start] SOCKS5 bridge started on :1080 (upstream: $UPSTREAM_PROXY)" sleep 2 # --- KB server (Flask on port 8811) --- cd /app gunicorn -w 2 -b 0.0.0.0:8811 kb_server:app > /tmp/kb_server.log 2>&1 & echo "[start] KB server started on :8811" # --- Generate picoclaw config --- python3 /app/gen_config.py > /app/.picoclaw/config.json 2>/tmp/gen_config.log echo "[start] Config generated" # --- Picoclaw gateway --- /usr/local/bin/picoclaw gateway > /tmp/picoclaw.log 2>&1 & echo "[start] Picoclaw gateway started" # --- Code-server (port 7860, required by HF Space) --- export PASSWORD="${PASSWORD:-Hermes2026!Dev}" exec code-server --bind-addr 0.0.0.0:7860 --auth password /app