betterwithage commited on
Commit
1f41dc3
·
verified ·
1 Parent(s): d2c9030

hf-sync: mirror front-door from GitHub c4bc67a4

Browse files
Files changed (3) hide show
  1. README.md +17 -0
  2. index.html +2 -0
  3. v6_alive.js +200 -0
README.md CHANGED
@@ -68,6 +68,23 @@ through the same five-part contract: **Purpose · Try · Evidence · Limits · R
68
  - `/.well-known/szl-source.json` exposes the declared GitHub base, measured HF
69
  revision, artifact-set digest, and the remaining GitHub-sync state.
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  Machine-readable routes:
72
 
73
  | Route | Meaning |
 
68
  - `/.well-known/szl-source.json` exposes the declared GitHub base, measured HF
69
  revision, artifact-set digest, and the remaining GitHub-sync state.
70
 
71
+ ## v6 — alive-proof layer (ratchet 2026-07-21)
72
+
73
+ The **⛬ alive-proof (v6)** control closes the loop between the map and the
74
+ running substrate. It fetches the latest anatomy alive-harness run from the
75
+ restored public sink ([`SZLHOLDINGS/test-results`](https://huggingface.co/datasets/SZLHOLDINGS/test-results)),
76
+ verifies the run's DSSE (PAE v1) ECDSA-P256 signature **in the browser**
77
+ against the pinned, committed org key
78
+ ([`hatun-mcp/PUBKEY_szlholdings-ec-p256.pem`](https://github.com/szl-holdings/hatun-mcp/blob/main/PUBKEY_szlholdings-ec-p256.pem)),
79
+ and only then displays the run — verdict, live assertion counts, per-layer
80
+ results, and the formula-gate pass rate, all **derived from the signed
81
+ evidence**, never hand-typed. Runs are signed by the live Hatun MCP gateway
82
+ (`dsse_sign`, keyid `szlholdings-ec-p256`) and published by a fail-closed
83
+ publisher that verifies before and after upload. If the sink is unreachable or
84
+ a signature fails, the panel says so — no fabricated green light. A signed
85
+ GREEN run proves liveness, not doctrine upgrades: locked-proven stays exactly
86
+ 8 and Λ remains Conjecture 1.
87
+
88
  Machine-readable routes:
89
 
90
  | Route | Meaning |
index.html CHANGED
@@ -1766,5 +1766,7 @@
1766
  <script src="./v5_organs.js"></script>
1767
  <!-- Evidence Bay: industrial proof boundary + five-part capability contract. Read-only, zero CDN. -->
1768
  <script src="./frontier_anatomy.js"></script>
 
 
1769
  </body>
1770
  </html>
 
1766
  <script src="./v5_organs.js"></script>
1767
  <!-- Evidence Bay: industrial proof boundary + five-part capability contract. Read-only, zero CDN. -->
1768
  <script src="./frontier_anatomy.js"></script>
1769
+ <!-- v6 alive-proof layer (ratchet 2026-07-21): latest alive-harness run fetched from the public DSSE-signed sink and ECDSA-P256 signature-verified IN THE BROWSER before display. Additive, fail-closed, zero-CDN. -->
1770
+ <script src="./v6_alive.js"></script>
1771
  </body>
1772
  </html>
v6_alive.js ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* =====================================================================
2
+ v6_alive.js — SZL Living Anatomy · v6 ALIVE-PROOF LAYER (additive)
3
+ =====================================================================
4
+ The v6 ratchet: the map stops describing the substrate and starts
5
+ PROVING it. This layer fetches the latest anatomy alive-harness run
6
+ from the public DSSE-signed sink (SZLHOLDINGS/test-results), verifies
7
+ the ECDSA-P256 signature IN THE BROWSER (WebCrypto, DSSE PAE v1)
8
+ against the committed org public key, and only then displays the run.
9
+
10
+ FAIL-CLOSED DISCIPLINE (binding):
11
+ - No signature verification → the panel shows UNVERIFIED / UNREACHABLE.
12
+ We never display an unverified number as a verified one.
13
+ - The public key is pinned below AND cross-checked against the
14
+ committed copy at hatun-mcp/main/PUBKEY_szlholdings-ec-p256.pem.
15
+ A mismatch is displayed as a key-pin failure, not silently ignored.
16
+ - The Hatun MCP gateway chip goes LIVE only on a real 2xx server-card
17
+ fetch with a parseable tool inventory.
18
+ - Doctrine v11 LOCKED is unchanged: locked-proven stays EXACTLY 8
19
+ (F1 F4 F7 F11 F12 F18 F19 F22); Λ is Conjecture 1, never a theorem.
20
+ A signed GREEN harness run proves liveness, not doctrine upgrades.
21
+ Additive, read-only, zero-CDN. No key is sent; open surfaces only.
22
+ ===================================================================== */
23
+ (function (root) {
24
+ 'use strict';
25
+
26
+ var SINK = 'https://huggingface.co/datasets/SZLHOLDINGS/test-results';
27
+ var RUNS_URL = SINK + '/resolve/main/harness_runs.jsonl';
28
+ var PUBKEY_URL = 'https://raw.githubusercontent.com/szl-holdings/hatun-mcp/main/PUBKEY_szlholdings-ec-p256.pem';
29
+ var HATUN_CARD = 'https://szlholdings-hatun-mcp.hf.space/.well-known/mcp/server-card.json';
30
+
31
+ /* Pinned committed org public key (SPKI, P-256) — szlholdings-ec-p256 */
32
+ var PIN_PEM = '-----BEGIN PUBLIC KEY-----\n'
33
+ + 'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEk+AEVaqvPGGBF/OAEpr7/3hcNHgF\n'
34
+ + 'bXn+bqq0egeockovraAuzkfbVf6kiH6wAy01iaBtv3j/1W2Amx/xbUnelQ==\n'
35
+ + '-----END PUBLIC KEY-----';
36
+
37
+ function el(tag, cls, html) { var e = document.createElement(tag); if (cls) e.className = cls; if (html != null) e.innerHTML = html; return e; }
38
+ function esc(s) { return String(s == null ? '' : s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'); }
39
+ function b64ToBytes(b64) { var bin = atob(b64.replace(/\s+/g, '')); var out = new Uint8Array(bin.length); for (var i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i); return out; }
40
+ function pemToSpki(pem) { return b64ToBytes(pem.replace(/-----[^-]+-----/g, '').replace(/\s+/g, '')); }
41
+ function utf8(s) { return new TextEncoder().encode(s); }
42
+ function concatBytes(parts) { var n = 0, i; for (i = 0; i < parts.length; i++) n += parts[i].length; var out = new Uint8Array(n), o = 0; for (i = 0; i < parts.length; i++) { out.set(parts[i], o); o += parts[i].length; } return out; }
43
+
44
+ /* DSSE PAE v1: "DSSEv1 SP len(type) SP type SP len(payload) SP payload" */
45
+ function pae(payloadType, payloadBytes) {
46
+ var t = utf8(payloadType);
47
+ return concatBytes([utf8('DSSEv1 ' + t.length + ' '), t, utf8(' ' + payloadBytes.length + ' '), payloadBytes]);
48
+ }
49
+
50
+ /* ECDSA sig from gateway is ASN.1/DER; WebCrypto wants raw r||s (P1363). */
51
+ function derToP1363(der) {
52
+ var i = 2; /* SEQUENCE, len (assume short-form or 1-byte long-form) */
53
+ if (der[1] & 0x80) i = 2 + (der[1] & 0x7f);
54
+ function readInt() {
55
+ if (der[i] !== 0x02) throw new Error('bad DER');
56
+ var len = der[i + 1]; i += 2;
57
+ var v = der.slice(i, i + len); i += len;
58
+ while (v.length > 32 && v[0] === 0) v = v.slice(1);
59
+ var out = new Uint8Array(32); out.set(v, 32 - v.length); return out;
60
+ }
61
+ var r = readInt(), s = readInt();
62
+ return concatBytes([r, s]);
63
+ }
64
+
65
+ function verifyDsse(env) {
66
+ var payloadBytes = b64ToBytes(env.payload);
67
+ var msg = pae(env.payloadType, payloadBytes);
68
+ var sig = derToP1363(b64ToBytes(env.signatures[0].sig));
69
+ return crypto.subtle.importKey('spki', pemToSpki(PIN_PEM), { name: 'ECDSA', namedCurve: 'P-256' }, false, ['verify'])
70
+ .then(function (key) { return crypto.subtle.verify({ name: 'ECDSA', hash: 'SHA-256' }, key, sig, msg); })
71
+ .then(function (ok) { return { ok: ok, payload: JSON.parse(new TextDecoder().decode(payloadBytes)) }; });
72
+ }
73
+
74
+ function fetchText(url) { return fetch(url, { mode: 'cors', credentials: 'omit', cache: 'no-store' }).then(function (r) { if (!r.ok) throw new Error('HTTP ' + r.status); return r.text(); }); }
75
+
76
+ /* ---------------- styles ---------------- */
77
+ var css = [
78
+ '#v6panel{position:fixed;z-index:42;top:0;right:0;height:100%;width:min(460px,94vw);background:linear-gradient(180deg,rgba(8,14,22,.99),rgba(5,9,15,.98));border-left:1px solid rgba(255,255,255,.1);box-shadow:-8px 0 40px rgba(0,0,0,.5);transform:translateX(102%);transition:transform .32s cubic-bezier(.2,.7,.2,1);display:flex;flex-direction:column;pointer-events:auto}',
79
+ '#v6panel.open{transform:translateX(0)}',
80
+ '#v6panel .v6h{padding:20px 22px 14px;border-bottom:1px solid rgba(255,255,255,.1)}',
81
+ '#v6panel .v6h .eyebrow{font-family:var(--font-m,monospace);font-size:10px;letter-spacing:.16em;text-transform:uppercase;color:var(--text-dim,#8aa)}',
82
+ '#v6panel .v6h h2{font-size:20px;font-weight:700;margin:6px 0 0;line-height:1.15}',
83
+ '#v6panel .v6b{padding:16px 22px 90px;overflow:auto;font-size:12.5px;line-height:1.55;color:var(--text,#dfe)}',
84
+ '#v6panel .v6close{position:absolute;top:14px;right:14px;background:none;border:1px solid rgba(255,255,255,.18);color:var(--text,#dfe);border-radius:8px;width:30px;height:30px;cursor:pointer;font-size:16px;line-height:1}',
85
+ '.v6-chip{font-family:var(--font-m,monospace);font-size:9.5px;letter-spacing:.06em;border:1px solid currentColor;border-radius:6px;padding:1px 6px;white-space:nowrap}',
86
+ '.v6-chip.ok{color:#69f0ae}.v6-chip.bad{color:#ff7eb6}.v6-chip.wait{color:#9ea7c0}.v6-chip.warn{color:#ffd166}',
87
+ '.v6-card{border:1px solid rgba(255,255,255,.12);border-radius:12px;padding:13px 14px;margin:11px 0;background:rgba(255,255,255,.02)}',
88
+ '.v6-card .h{display:flex;align-items:center;gap:8px;justify-content:space-between;font-weight:700;font-size:13.5px}',
89
+ '.v6-mono{font-family:var(--font-m,monospace);font-size:11px;background:rgba(0,0,0,.34);border-left:2px solid #69f0ae;border-radius:6px;padding:8px 10px;margin-top:8px;white-space:pre-wrap;word-break:break-word;color:#e7ecff}',
90
+ '.v6-note{border:1px solid #ffd166;background:rgba(255,209,102,.07);border-radius:10px;padding:11px 13px;margin:12px 0;font-size:12px}',
91
+ '.v6-layers{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:8px}',
92
+ '.v6-layers .cell{border:1px solid rgba(255,255,255,.1);border-radius:8px;padding:6px 8px;font-family:var(--font-m,monospace);font-size:10.5px}'
93
+ ].join('\n');
94
+
95
+ /* ---------------- panel ---------------- */
96
+ var panel, body;
97
+ function buildPanel() {
98
+ var st = el('style'); st.textContent = css; document.head.appendChild(st);
99
+ panel = el('div'); panel.id = 'v6panel';
100
+ var h = el('div', 'v6h');
101
+ h.appendChild(el('div', 'eyebrow', 'v6 alive-proof layer · verify-then-display'));
102
+ h.appendChild(el('h2', null, 'Alive-Harness · DSSE-verified in this browser'));
103
+ var x = el('button', 'v6close', '×'); x.setAttribute('aria-label', 'Close'); x.addEventListener('click', close);
104
+ h.appendChild(x);
105
+ body = el('div', 'v6b', '<span class="v6-chip wait">FETCHING…</span> pulling the latest signed harness run…');
106
+ panel.appendChild(h); panel.appendChild(body);
107
+ document.body.appendChild(panel);
108
+ }
109
+ function open() { panel.classList.add('open'); refresh(); }
110
+ function close() { panel.classList.remove('open'); }
111
+
112
+ function render(state) {
113
+ body.innerHTML = '';
114
+ var run = state.run;
115
+ if (state.status !== 'VERIFIED') {
116
+ var chip = state.status === 'UNREACHABLE' ? 'bad' : 'warn';
117
+ body.appendChild(el('div', 'v6-note',
118
+ '<b><span class="v6-chip ' + chip + '">' + esc(state.status) + '</span></b> ' + esc(state.detail || '')
119
+ + '<br><br>Fail-closed: nothing is displayed as verified without an in-browser '
120
+ + 'ECDSA-P256 signature check against the committed org key. '
121
+ + '<a href="' + SINK + '" target="_blank" rel="noopener" style="color:#5ad1ff">Inspect the sink directly →</a>'));
122
+ return;
123
+ }
124
+ var c1 = el('div', 'v6-card');
125
+ c1.appendChild(el('div', 'h', 'Latest harness run <span class="v6-chip ' + (run.verdict === 'GREEN' ? 'ok' : 'warn') + '">' + esc(run.verdict) + ' · SIGNATURE VERIFIED</span>'));
126
+ c1.appendChild(el('p', null,
127
+ esc(run.assertions_passed + '/' + run.assertions_total) + ' live assertions · formula gates '
128
+ + esc(run.formula_gates_passed + '/' + run.formula_gates_total)
129
+ + ' · harness ' + esc(run.harness_version) + '<br>finished ' + esc(run.finishedAt)));
130
+ c1.appendChild(el('div', 'v6-mono',
131
+ 'keyid: ' + esc(state.keyid) + '\npin: committed PUBKEY_szlholdings-ec-p256.pem '
132
+ + (state.pinMatch === true ? '(cross-check MATCH)' : state.pinMatch === false ? '(CROSS-CHECK MISMATCH!)' : '(cross-check unreachable)')
133
+ + '\nevidence sha256: ' + esc(run.evidence_sha256).slice(0, 32) + '…\nverified: in THIS browser via WebCrypto, DSSE PAE v1'));
134
+ body.appendChild(c1);
135
+
136
+ if (state.layers) {
137
+ var c2 = el('div', 'v6-card');
138
+ c2.appendChild(el('div', 'h', 'Layers (from the signed evidence)'));
139
+ var grid = el('div', 'v6-layers');
140
+ Object.keys(state.layers).forEach(function (k) {
141
+ var v = state.layers[k];
142
+ grid.appendChild(el('div', 'cell', esc(k) + ' · <span class="v6-chip ' + (v.fail ? 'warn' : 'ok') + '">' + v.pass + ' pass' + (v.fail ? ' · ' + v.fail + ' fail' : '') + '</span>'));
143
+ });
144
+ c2.appendChild(grid);
145
+ body.appendChild(c2);
146
+ }
147
+
148
+ var c3 = el('div', 'v6-card');
149
+ c3.appendChild(el('div', 'h', 'Hatun MCP gateway <span class="v6-chip ' + (state.hatun ? 'ok' : 'bad') + '">' + (state.hatun ? 'LIVE · ' + state.hatun + ' tools' : 'UNREACHABLE') + '</span>'));
150
+ c3.appendChild(el('p', null, 'The signer of this record: the live MCP gateway (dsse_sign, ECDSA-P256). Runs are published fail-closed — the publisher verifies before and after upload.'));
151
+ body.appendChild(c3);
152
+
153
+ body.appendChild(el('div', 'v6-note',
154
+ '<b>Doctrine boundary (unchanged):</b> a signed GREEN run proves the substrate is ALIVE '
155
+ + 'and its gates execute — it upgrades NO proof claim. Locked-proven stays exactly 8; '
156
+ + 'Λ remains Conjecture 1. '
157
+ + '<a href="' + SINK + '" target="_blank" rel="noopener" style="color:#5ad1ff">Sink + reproduce-it-yourself instructions →</a>'));
158
+ }
159
+
160
+ function refresh() {
161
+ var state = { status: 'UNREACHABLE', detail: '', hatun: 0, pinMatch: null };
162
+ var pHatun = fetchText(HATUN_CARD).then(function (t) {
163
+ var card = JSON.parse(t);
164
+ var tools = (card.tools && card.tools.length) || (card.capabilities && card.capabilities.tools && card.capabilities.tools.count) || 0;
165
+ state.hatun = tools || 'yes';
166
+ }).catch(function () { state.hatun = 0; });
167
+ var pPin = fetchText(PUBKEY_URL).then(function (t) {
168
+ state.pinMatch = t.replace(/\s+/g, '') === PIN_PEM.replace(/\s+/g, '');
169
+ }).catch(function () { state.pinMatch = null; });
170
+ var pRun = fetchText(RUNS_URL).then(function (txt) {
171
+ var lines = txt.trim().split('\n');
172
+ var rec = JSON.parse(lines[lines.length - 1]);
173
+ return verifyDsse(rec.dsse).then(function (v) {
174
+ if (!v.ok) { state.status = 'UNVERIFIED'; state.detail = 'Signature did NOT verify against the pinned org key. Refusing to display the run as verified.'; return; }
175
+ state.status = 'VERIFIED';
176
+ state.run = v.payload;
177
+ state.keyid = rec.dsse.signatures[0].keyid || 'szlholdings-ec-p256';
178
+ var stamp = (v.payload.finishedAt || '').replace(/[:\-]/g, '');
179
+ return fetchText(SINK + '/resolve/main/runs/' + stamp + '.evidence.json')
180
+ .then(function (ev) { state.layers = JSON.parse(ev).layers; }).catch(function () { /* layers optional */ });
181
+ });
182
+ }).catch(function (e) { state.status = 'UNREACHABLE'; state.detail = 'Could not fetch the signed sink (' + e.message + ').'; });
183
+ Promise.all([pHatun, pPin, pRun]).then(function () { render(state); });
184
+ }
185
+
186
+ /* ---------------- button (injected next to the v5 cluster) ---------------- */
187
+ function init() {
188
+ buildPanel();
189
+ var anchor = document.getElementById('btn-v5-stack') || document.getElementById('btn-v5-willay');
190
+ var btn = el('button', 'btn', '⛬ alive-proof (v6)');
191
+ btn.id = 'btn-v6-alive';
192
+ btn.title = 'v6 alive-proof layer: latest harness run fetched from the public DSSE-signed sink and signature-verified IN THIS BROWSER (WebCrypto, pinned org key) before display · fail-closed, never a fabricated green light';
193
+ btn.setAttribute('aria-controls', 'v6panel');
194
+ btn.addEventListener('click', function () { if (panel.classList.contains('open')) close(); else open(); });
195
+ if (anchor && anchor.parentNode) anchor.parentNode.appendChild(btn);
196
+ else document.body.appendChild(btn);
197
+ }
198
+ if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init); else init();
199
+
200
+ })(window);