From ecd34b36dc7931e1f9fabefd918d11b8ee641f77 Mon Sep 17 00:00:00 2001 From: Jeffrey Scudder Date: Thu, 23 Apr 2026 19:22:03 +0000 Subject: [PATCH] aa: auto-reload on new deploy so in-piece edits land live Poll /api/version after boot and trigger window:reload when the deployed build changes. Same pattern as dumduel. Lets @jeffrey edit aa.mjs through aa itself and see the changes without a manual refresh. Co-Authored-By: Claude Opus 4.7 (1M context) --- system/public/aesthetic.computer/disks/aa.mjs | 18 ++++++++++++++++++ 1 file(s) changed, 18 insertion(s)(+), 0 deletion(s)(-) diff --git a/system/public/aesthetic.computer/disks/aa.mjs b/system/public/aesthetic.computer/disks/aa.mjs --- a/system/public/aesthetic.computer/disks/aa.mjs +++ b/system/public/aesthetic.computer/disks/aa.mjs @@ -76,6 +76,24 @@ hudRef = hud; setStatus("loading"); userHandleRef = handle; + // Version polling — auto-reload on new deploy so edits to aa.mjs made + // from within aa itself come back live without a manual refresh. + (async () => { + try { + const res = await fetch("/api/version"); + if (!res.ok) return; + const current = (await res.json()).deployed; + while (true) { + try { + const r = await fetch(`/api/version?current=${current}`); + if (!r.ok) break; + const data = await r.json(); + if (data.changed !== false) { send?.({ type: "window:reload" }); break; } + } catch { break; } + } + } catch {} + })(); + if (!user?.sub) { setStatus("unauth"); pushSystem("log in first to talk to aa."); -- tangled.sh