{
  "format": "dockrun-bundle",
  "version": 1,
  "exportedAt": "2026-11-12T00:00:00Z",
  "workspaces": [],
  "workflows": [
    {
      "id": "FB78E75E-914D-5A62-90C0-B2EDAA39DE29",
      "name": "WARP auto-reconnect",
      "summary": "Watches Cloudflare WARP. If it drops: reconnect over HTTPS, rotate keys, go back to UDP.",
      "variables": [],
      "steps": [
        {
          "id": "9F937060-4A9C-5696-8FDF-F00B41BAC3E6",
          "actionID": "script.run",
          "input": {
            "language": "zsh",
            "code": "# Watches Cloudflare WARP. When it drops (not when you turn it off yourself), reconnects over\n# HTTPS/TCP (MASQUE h2-only), rotates the tunnel keys, then goes back to UDP (MASQUE h3-only).\nWARP=/usr/local/bin/warp-cli\nLOG=\"$HOME/Library/Logs/DockRun-warp-reconnect.log\"\nPIDFILE=\"${TMPDIR:-/tmp}/dockrun-warp-watch.pid\"\n[ -x \"$WARP\" ] || { echo \"warp-cli not found at $WARP\"; exit 1; }\n\nlog() { echo \"$(date '+%F %T') $*\" >> \"$LOG\"; }\nstate() { \"$WARP\" status 2>&1 | head -1; }\nwait_connected() {   # $1 = seconds to wait\n  local i; for i in $(seq \"$1\"); do case \"$(state)\" in *Connected*) return 0;; esac; sleep 1; done; return 1\n}\nrepair() {\n  log \"WARP dropped: $(state). Reconnecting over HTTPS (h2-only).\"\n  \"$WARP\" tunnel masque-options set h2-only >> \"$LOG\" 2>&1\n  \"$WARP\" connect >> \"$LOG\" 2>&1\n  wait_connected 30 || log \"HTTPS did not connect within 30s; rotating keys anyway.\"\n  \"$WARP\" tunnel rotate-keys >> \"$LOG\" 2>&1\n  \"$WARP\" tunnel masque-options set h3-only >> \"$LOG\" 2>&1\n  \"$WARP\" connect >> \"$LOG\" 2>&1\n  if wait_connected 30; then log \"Back on UDP (h3-only).\"; return 0; fi\n  # UDP is blocked on this network: allow the HTTPS fallback again rather than staying offline.\n  log \"UDP did not connect within 30s; back to the default (UDP with HTTPS fallback).\"\n  \"$WARP\" tunnel masque-options reset >> \"$LOG\" 2>&1\n  \"$WARP\" connect >> \"$LOG\" 2>&1\n}\n\nif [ \"$1\" = \"repair-now\" ]; then repair; state; exit 0; fi\nif [ -f \"$PIDFILE\" ] && kill -0 \"$(cat \"$PIDFILE\")\" 2>/dev/null; then\n  echo \"Already watching WARP (pid $(cat \"$PIDFILE\")). Now: $(state)\"; exit 0\nfi\n\n(\n  drops=0\n  while true; do\n    s=\"$(state)\"\n    case \"$s\" in\n      *Disconnected*Manual*) drops=0 ;;                      # you turned it off: leave it alone\n      *Disconnected*) drops=$((drops + 1)); [ \"$drops\" -ge 2 ] && { repair; drops=0; } ;;\n      *) drops=0 ;;\n    esac\n    sleep 10\n  done\n) > /dev/null 2>&1 &\necho $! > \"$PIDFILE\"\ndisown\nlog \"Watcher started (pid $(cat \"$PIDFILE\")).\"\necho \"Watching WARP every 10s (pid $(cat \"$PIDFILE\")). Now: $(state). Log: $LOG\"\n"
          },
          "condition": {
            "kind": "always"
          },
          "onFailure": "stop",
          "timeout": 60,
          "isEnabled": true,
          "title": "Start the WARP watcher"
        }
      ]
    }
  ]
}
