1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>stream · status</title>
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<meta name="theme-color" content="#040708">
<meta name="description" content="live field report for stream.waow.tech — ingest, archive, and repository state">
<meta property="og:title" content="stream · status">
<meta property="og:description" content="live field report for stream.waow.tech — ingest, archive, and repository state">
<meta property="og:type" content="website">
<meta property="og:url" content="https://stream.waow.tech/status">
<meta name="twitter:card" content="summary">
<link rel="stylesheet" href="/brand.css?v=2">
</head>
<body data-page="status">
<div id="atmosphere" aria-hidden="true"><canvas id="depth" data-current></canvas></div>
<div class="wrap">
<header>
<a class="brand" href="/">~ s t r e a m ~</a>
<span class="livedot" id="live">· connecting</span>
</header>
<main>
<div class="sect">field report</div>
<div id="report" class="report">loading…</div>
</main>
<footer>
<a href="/">home</a>
<a href="/stats">stats</a>
<a href="/status" aria-current="page">status</a>
<a href="/strata/">strata</a>
<a id="commit" href="https://tangled.org/zat.dev/stream">build</a>
<a href="https://tangled.org/zat.dev/stream">source</a>
</footer>
</div>
<script src="/ambient.js?v=crystal-1"></script>
<script>
const $ = (id) => document.getElementById(id);
let _prevSeq = null;
let _prevSeqAt = 0, _rateEma = null;
try {
const c = JSON.parse(sessionStorage.getItem("seqCont") || "null");
if (c && Date.now() - c.t < 60_000 && BigInt(c.seq) > 0n) {
_prevSeq = BigInt(c.seq); _prevSeqAt = performance.now() - (Date.now() - c.t);
_rateEma = c.ema;
}
} catch {}
function saveCont(upN){
try { sessionStorage.setItem("seqCont", JSON.stringify({ seq: upN.toString(), t: Date.now(), ema: _rateEma })); } catch {}
}
window.__ingestRate = () => _rateEma;
function noteRate(upN){
const now = performance.now();
if (_prevSeq !== null && upN > _prevSeq && _prevSeqAt > 0) {
const inst = Number(upN - _prevSeq) * 1000 / (now - _prevSeqAt);
_rateEma = _rateEma === null ? inst : 0.6 * _rateEma + 0.4 * inst;
} else if (upN === _prevSeq) { _rateEma = _rateEma === null ? 0 : 0.6 * _rateEma; }
_prevSeqAt = now;
}
async function fetchStatus(){
const t = await (await fetch("/status",{headers:{Accept:"text/plain"},cache:"no-store"})).text();
const g = (re)=>{const m=t.match(re);return m?m[1]:null};
const build = g(/build ([0-9a-f]{7,})/);
if(build && $("commit")){
$("commit").textContent = build;
$("commit").href = "https://tangled.org/zat.dev/stream/commits/" + build;
}
// honest live-tail signal: the upstream seq must exist AND advance between
// reads. "state live" from the binary only means the process is serving.
const up = g(/upstream seq\s+([\d,]+)/);
const upN = up ? BigInt(up.replace(/,/g,"")) : 0n;
if (upN > 0n) dispatchEvent(new CustomEvent("stream-sequence", {detail:upN.toString()}));
const flowing = upN > 0n && _prevSeq !== null && upN > _prevSeq;
const stalled = upN > 0n && _prevSeq !== null && upN === _prevSeq;
if (upN > 0n) { noteRate(upN); saveCont(upN); _prevSeq = upN; }
const rateTxt = _rateEma !== null && _rateEma >= 1 ? " · ≈" + Math.round(_rateEma).toLocaleString() + " events/s" : "";
if($("live")) $("live").innerHTML =
flowing ? "<b>●</b> live tail flowing" + rateTxt :
stalled ? "· live tail stalled · archive serving" :
upN > 0n ? "· checking tail…" :
"· live tail paused · archive serving";
return { t, g };
}
(() => {
async function tick(){
try{
const { t } = await fetchStatus();
const sections = [];
for (const block of t.split(/\n\s*\n/)) {
const lines = block.trim().split('\n');
if (!lines[0] || lines[0] === 'stream field report' || lines[0].startsWith('build ')) continue;
const section = document.createElement('section');
if (!/ {2,}/.test(lines[0])) {
const heading = document.createElement('h2');
heading.textContent = lines.shift(); section.append(heading);
}
const rows = document.createElement('dl');
const prose = [];
for (const line of lines) {
const pair = line.trim().match(/^(.+?)(?: {2,}| (?=\d))(.+)$/);
if (pair) {
const key = document.createElement('dt'), value = document.createElement('dd');
key.textContent = pair[1]; value.textContent = pair[2]; rows.append(key, value);
} else prose.push(line.trim());
}
if (rows.children.length) section.append(rows);
if (prose.length) { const paragraph = document.createElement('p'); paragraph.textContent = prose.join(' '); section.append(paragraph); }
sections.push(section);
}
$("report").replaceChildren(...sections);
}catch(e){ $("report").textContent = "unreachable"; }
}
tick(); setInterval(tick, 5000);
})();
</script>
</body>
</html>