Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(ui-preview): seed the runtime connection through a bootstrap page

Steven Enamakel037400dffae2
diff --git a/.tinysweeper/ui-preview.json b/.tinysweeper/ui-preview.json
index 2e4306ef3a..3c43f5ac79 100644
--- a/.tinysweeper/ui-preview.json
+++ b/.tinysweeper/ui-preview.json
@@ -4,10 +4,9 @@
"timeout_s": 1500,
"viewport": [1440, 900],
"auth": {
+ "visit": "/__preview-connect.html",
"cookies": [],
"localStorage": {
- "openhuman_core_mode": "cloud",
- "openhuman_core_rpc_token": "ui-preview-core-token",
"openhuman:walkthrough_completed": "true"
}
},
diff --git a/scripts/ui-preview/serve.sh b/scripts/ui-preview/serve.sh
index 0fb2400aa5..524a7f6842 100755
--- a/scripts/ui-preview/serve.sh
+++ b/scripts/ui-preview/serve.sh
@@ -41,6 +41,22 @@ fi
echo "[ui-preview :$TS_PORT] building the web bundle"
(cd "$APP_DIR" && pnpm run build:web)
+# The bootstrap page the action opens first (`auth.visit` in
+# .tinysweeper/ui-preview.json). Same job as the dev server's `/__dev-connect`
+# route: seed the runtime endpoint, its bearer and the cloud mode into
+# localStorage, then go to the app. Written here because the RPC URL depends
+# on this side's core port, which only this script knows.
+cat > "$APP_DIR/dist-web/__preview-connect.html" <<CONNECT
+<!doctype html><meta charset="utf-8"><title>connecting</title><script>
+localStorage.setItem("openhuman_core_rpc_url", "http://127.0.0.1:${CORE_PORT}/rpc");
+localStorage.setItem("openhuman_core_rpc_token", "${CORE_TOKEN}");
+localStorage.setItem("openhuman_core_mode", "cloud");
+localStorage.setItem("openhuman:walkthrough_completed", "true");
+localStorage.removeItem("openhuman:walkthrough_pending");
+location.replace("/#/chat");
+</script>
+CONNECT
+
if [ -n "${TS_SHARED_CORE_BIN:-}" ] && [ -x "$TS_SHARED_CORE_BIN" ]; then
CORE_BIN="$TS_SHARED_CORE_BIN"
else