shadok-ai 0.16.3 → 0.16.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/index.html +23 -2
package/package.json
CHANGED
package/public/index.html
CHANGED
|
@@ -7059,11 +7059,28 @@
|
|
|
7059
7059
|
addTurn(t, "system", "", "Your unsent message is back in the box — the link dropped before it was sent.");
|
|
7060
7060
|
}
|
|
7061
7061
|
const n = t.reconnectAttempts++;
|
|
7062
|
-
|
|
7063
|
-
|
|
7062
|
+
// An auto-update installs the new version in the BACKGROUND and the
|
|
7063
|
+
// supervisor respawns it in ~1s, so the server is only briefly gone — but
|
|
7064
|
+
// the exponential backoff below climbs while it is (1→2→4→8→15s), so a tab
|
|
7065
|
+
// that drops mid-update can sit idle 8–15s AFTER the server is already back
|
|
7066
|
+
// before it retries. The server tells us this is coming (`server-reload`),
|
|
7067
|
+
// so in that window we retry on a tight fixed interval and catch it the
|
|
7068
|
+
// instant it returns — then the fresh `version` triggers the page reload.
|
|
7069
|
+
// The window is bounded (`reloadExpectedUntil`), so a failed/aborted update
|
|
7070
|
+
// falls back to normal backoff instead of hammering forever.
|
|
7071
|
+
const eager = Date.now() < reloadExpectedUntil;
|
|
7072
|
+
const delay = eager
|
|
7073
|
+
? 600 + Math.floor(Math.random() * 300) // ~0.6–0.9s, no growth
|
|
7074
|
+
: Math.min(15000, 1000 * 2 ** n) + Math.floor(Math.random() * 500);
|
|
7075
|
+
setTabState(t, "dead", eager ? "updating — reconnecting…" : "link lost — reconnecting…");
|
|
7064
7076
|
t.reconnectTimer = setTimeout(() => { if (!t.closing) openLink(t); }, delay);
|
|
7065
7077
|
}
|
|
7066
7078
|
|
|
7079
|
+
// Set when the server announces an imminent restart (`server-reload`): until
|
|
7080
|
+
// this instant, `scheduleReconnect` reconnects eagerly rather than backing
|
|
7081
|
+
// off. Bounded so an update that never lands doesn't leave us hammering.
|
|
7082
|
+
let reloadExpectedUntil = 0;
|
|
7083
|
+
|
|
7067
7084
|
/** Reconnect every dropped tab immediately (no backoff wait) — fired when the
|
|
7068
7085
|
* machine/tab comes back (online / visible), the common laptop-wake case.
|
|
7069
7086
|
* `force` replaces even a socket that still reports OPEN: after a laptop
|
|
@@ -7758,6 +7775,10 @@
|
|
|
7758
7775
|
break;
|
|
7759
7776
|
case "server-reload":
|
|
7760
7777
|
showUpdateBanner(msg.version);
|
|
7778
|
+
// The server is installing a new version and will be back in ~1s;
|
|
7779
|
+
// reconnect eagerly (not backed off) for the next 90s so the page
|
|
7780
|
+
// reloads onto the new build quickly instead of waiting out a backoff.
|
|
7781
|
+
reloadExpectedUntil = Date.now() + 90_000;
|
|
7761
7782
|
break;
|
|
7762
7783
|
case "history":
|
|
7763
7784
|
// Full replay from the transcript (source of truth). Clear first so a
|