Spaces:
Running
Running
deploy(hf): sync szl-holdings/a11oy@main derived COPY set
Browse filesReusable Dockerfile-COPY-derived deploy from szl-holdings/a11oy main.
Files: 1126 Pruned: 0
Derived from Dockerfile COPY sources (NO hand-maintained allowlist).
Signed-off-by: SZL Holdings <noreply@szlholdings.ai>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- a11oy_frontier_page.py +6 -16
- pages/hatun-mcp.html +57 -67
- serve.py +3 -34
- szl_agentic_loop.py +22 -187
- szl_frontier_manifest.py +60 -314
- szl_gpu_quant.py +27 -418
- web/immune.html +43 -134
a11oy_frontier_page.py
CHANGED
|
@@ -20,8 +20,7 @@ The whole stack on one surface:
|
|
| 20 |
- the multi-node sovereign GPU fabric (REAL reachability probe),
|
| 21 |
- the MODELED orbital tier (links out to the /orbital page),
|
| 22 |
- governance / restraint (codified doctrine + signed DSSE receipts),
|
| 23 |
-
- the composite inference-provenance
|
| 24 |
-
has minted an independently visible artifact).
|
| 25 |
|
| 26 |
HONESTY (doctrine v11, non-negotiable):
|
| 27 |
* A persistent honest banner is pinned to the top of every viewport and a
|
|
@@ -688,7 +687,7 @@ function tileCard(t) {{
|
|
| 688 |
else if (label === 'SAMPLE')
|
| 689 |
banner = `<div class="tile-banner sample">SAMPLE — illustrative value, never billable or live.</div>`;
|
| 690 |
else if (label === 'UNAVAILABLE')
|
| 691 |
-
banner = `<div class="tile-banner unavailable">UNAVAILABLE — source
|
| 692 |
return `<div class="card" style="--edge:${{edge}}">
|
| 693 |
<div class="cat">${{esc(t.category || '')}}</div>
|
| 694 |
<h3><span>${{esc(t.name || '')}}</span><span class="badge ${{c}}">${{esc(label)}}</span></h3>
|
|
@@ -793,11 +792,6 @@ document.getElementById('brain-query-form').addEventListener('submit', async eve
|
|
| 793 |
const tiles = m.capabilities || [];
|
| 794 |
const s = m.summary || {{}};
|
| 795 |
const lc = s.label_counts || {{}};
|
| 796 |
-
const source = s.source_reachability || {{state:'UNKNOWN'}};
|
| 797 |
-
const readiness = s.operational_readiness || {{state:'UNKNOWN', ready:false, blocked_tiles:[]}};
|
| 798 |
-
const blockedNames = Array.isArray(readiness.blocked_tiles)
|
| 799 |
-
? readiness.blocked_tiles.map(row => row && row.name ? row.name : row).filter(Boolean)
|
| 800 |
-
: [];
|
| 801 |
|
| 802 |
// roll-up chips (honest counts straight from the manifest)
|
| 803 |
document.getElementById('rollup').innerHTML = [
|
|
@@ -805,22 +799,18 @@ document.getElementById('brain-query-form').addEventListener('submit', async eve
|
|
| 805 |
`<span class="chip">MEASURED <b>${{esc(lc.MEASURED || 0)}}</b></span>`,
|
| 806 |
`<span class="chip">MODELED <b>${{esc(lc.MODELED || 0)}}</b></span>`,
|
| 807 |
`<span class="chip">ROADMAP <b>${{esc(lc.ROADMAP || 0)}}</b></span>`,
|
| 808 |
-
`<span class="chip">
|
| 809 |
-
`<span class="chip">operational readiness <b>${{esc(readiness.state || 'UNKNOWN')}}</b></span>`,
|
| 810 |
(s.degraded_tiles && s.degraded_tiles.length)
|
| 811 |
? `<span class="chip">degraded: <b>${{esc(s.degraded_tiles.join(', '))}}</b></span>` : '',
|
| 812 |
-
blockedNames.length
|
| 813 |
-
? `<span class="chip">not ready: <b>${{esc(blockedNames.join(', '))}}</b></span>` : '',
|
| 814 |
].join('');
|
| 815 |
|
| 816 |
document.getElementById('grid').innerHTML = tiles.map(tileCard).join('');
|
| 817 |
drawConstellation(tiles);
|
| 818 |
|
| 819 |
const el = document.getElementById('status');
|
| 820 |
-
el.textContent = '
|
| 821 |
-
' · ' + esc(s.tiles ?? tiles.length) + ' tiles ·
|
| 822 |
-
esc(
|
| 823 |
-
esc(readiness.state || 'UNKNOWN');
|
| 824 |
document.getElementById('subline').innerHTML =
|
| 825 |
'Every capability we run, on one screen — composed live by <code>/frontier/manifest</code>. ' +
|
| 826 |
'Each tile shows its <b>honest label</b> and a <b>link to the proof</b>. No label is upgraded.';
|
|
|
|
| 20 |
- the multi-node sovereign GPU fabric (REAL reachability probe),
|
| 21 |
- the MODELED orbital tier (links out to the /orbital page),
|
| 22 |
- governance / restraint (codified doctrine + signed DSSE receipts),
|
| 23 |
+
- the ROADMAP composite inference-provenance-receipt play (clearly labeled).
|
|
|
|
| 24 |
|
| 25 |
HONESTY (doctrine v11, non-negotiable):
|
| 26 |
* A persistent honest banner is pinned to the top of every viewport and a
|
|
|
|
| 687 |
else if (label === 'SAMPLE')
|
| 688 |
banner = `<div class="tile-banner sample">SAMPLE — illustrative value, never billable or live.</div>`;
|
| 689 |
else if (label === 'UNAVAILABLE')
|
| 690 |
+
banner = `<div class="tile-banner unavailable">UNAVAILABLE — sub-source down right now; reported honestly, not faked.</div>`;
|
| 691 |
return `<div class="card" style="--edge:${{edge}}">
|
| 692 |
<div class="cat">${{esc(t.category || '')}}</div>
|
| 693 |
<h3><span>${{esc(t.name || '')}}</span><span class="badge ${{c}}">${{esc(label)}}</span></h3>
|
|
|
|
| 792 |
const tiles = m.capabilities || [];
|
| 793 |
const s = m.summary || {{}};
|
| 794 |
const lc = s.label_counts || {{}};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 795 |
|
| 796 |
// roll-up chips (honest counts straight from the manifest)
|
| 797 |
document.getElementById('rollup').innerHTML = [
|
|
|
|
| 799 |
`<span class="chip">MEASURED <b>${{esc(lc.MEASURED || 0)}}</b></span>`,
|
| 800 |
`<span class="chip">MODELED <b>${{esc(lc.MODELED || 0)}}</b></span>`,
|
| 801 |
`<span class="chip">ROADMAP <b>${{esc(lc.ROADMAP || 0)}}</b></span>`,
|
| 802 |
+
`<span class="chip">all sources live: <b>${{esc(String(s.all_sources_live))}}</b></span>`,
|
|
|
|
| 803 |
(s.degraded_tiles && s.degraded_tiles.length)
|
| 804 |
? `<span class="chip">degraded: <b>${{esc(s.degraded_tiles.join(', '))}}</b></span>` : '',
|
|
|
|
|
|
|
| 805 |
].join('');
|
| 806 |
|
| 807 |
document.getElementById('grid').innerHTML = tiles.map(tileCard).join('');
|
| 808 |
drawConstellation(tiles);
|
| 809 |
|
| 810 |
const el = document.getElementById('status');
|
| 811 |
+
el.textContent = 'live · composed from ' + esc(MANIFEST_EP) +
|
| 812 |
+
' · ' + esc(s.tiles ?? tiles.length) + ' tiles · all_sources_live=' +
|
| 813 |
+
esc(String(s.all_sources_live));
|
|
|
|
| 814 |
document.getElementById('subline').innerHTML =
|
| 815 |
'Every capability we run, on one screen — composed live by <code>/frontier/manifest</code>. ' +
|
| 816 |
'Each tile shows its <b>honest label</b> and a <b>link to the proof</b>. No label is upgraded.';
|
pages/hatun-mcp.html
CHANGED
|
@@ -9,7 +9,7 @@ a{color:var(--gold);text-decoration:none}a:hover{text-decoration:underline}
|
|
| 9 |
header{border-bottom:1px solid var(--line);padding:14px 22px;display:flex;align-items:center;gap:14px;background:linear-gradient(180deg,#10121b,#0a0b10)}
|
| 10 |
header .brand{font-weight:700;letter-spacing:.5px;color:var(--gold);font-size:18px}
|
| 11 |
header .tag{color:var(--mut);font-size:12px}
|
| 12 |
-
nav{display:flex;flex-wrap:
|
| 13 |
nav a{font-size:12.5px;padding:4px 10px;border:1px solid var(--line);border-radius:999px;color:var(--mut)}
|
| 14 |
nav a:hover{border-color:var(--gold);color:var(--gold);text-decoration:none}
|
| 15 |
nav a.active{background:var(--gold);color:#0a0b10;border-color:var(--gold);font-weight:600}
|
|
@@ -22,8 +22,6 @@ h1{font-size:26px;margin:0 0 4px;color:#fff}h2{font-size:18px;margin:28px 0 10px
|
|
| 22 |
.grid a.tile:hover{border-color:var(--gold);text-decoration:none}
|
| 23 |
.grid a.tile .t{color:var(--gold);font-weight:600;margin-bottom:4px}.grid a.tile .d{color:var(--mut);font-size:12.5px}
|
| 24 |
table{width:100%;border-collapse:collapse;margin:12px 0;font-size:13.5px}
|
| 25 |
-
.table-wrap{width:100%;overflow-x:auto;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch}
|
| 26 |
-
.table-wrap table{min-width:620px}
|
| 27 |
th,td{text-align:left;padding:8px 10px;border-bottom:1px solid var(--line);vertical-align:top}
|
| 28 |
th{color:var(--mut);font-weight:600;font-size:12px;text-transform:uppercase;letter-spacing:.4px}
|
| 29 |
code,pre{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12.5px}
|
|
@@ -37,22 +35,12 @@ footer{border-top:1px solid var(--line);color:var(--mut);font-size:11.5px;paddin
|
|
| 37 |
.statline b{color:var(--ink)}
|
| 38 |
.tag2{display:inline-block;background:#1c2030;color:var(--mut);border:1px solid var(--line);border-radius:6px;padding:1px 7px;font-size:11px;margin-left:6px}
|
| 39 |
.st{color:var(--amb);font-weight:600}
|
| 40 |
-
@media(max-width:700px){
|
| 41 |
-
header{padding:12px 14px;align-items:flex-start;flex-direction:column;gap:2px}
|
| 42 |
-
nav{padding:9px 14px}
|
| 43 |
-
main{padding:20px 14px 44px}
|
| 44 |
-
h1{font-size:23px;line-height:1.25}
|
| 45 |
-
.card{padding:15px}
|
| 46 |
-
.statline{display:grid;grid-template-columns:1fr;gap:8px}
|
| 47 |
-
pre{white-space:pre-wrap;overflow-wrap:anywhere}
|
| 48 |
-
footer{padding:16px 14px}
|
| 49 |
-
}
|
| 50 |
</style></head><body>
|
| 51 |
<header><span class="brand">a11oy</span><span class="tag">Brand Orchestration Layer · the one place to see everything</span></header>
|
| 52 |
<nav><a href="/hub">Hub</a><a href="/a11oy.code">a11oy.code</a><a href="/docs">Docs</a><a href="/pricing">Pricing</a><a href="/api-keys">API Keys</a><a href="/sdk">SDK</a><a href="/status">Status</a><a href="/hatun-mcp" class="active">Hatun-MCP</a><a href="/observability">Observability</a><a href="/security">Security</a><a href="/compliance">Compliance</a><a href="/cued-engagement">Cued Engagement</a><a href="/uds">UDS</a><a href="/counter-uas">Counter-UAS</a><a href="/evidence">Evidence</a><a href="/upgrades">Upgrades</a><a href="/audit">Audit</a><a href="/gap-report">Gap Report</a></nav>
|
| 53 |
<main>
|
| 54 |
<h1>Hatun-MCP — agentic MCP server</h1>
|
| 55 |
-
<p class="sub"><b>Hatun</b> (Quechua: <i>great / sovereign</i>) is the Model Context Protocol gateway
|
| 56 |
|
| 57 |
<div class="card">
|
| 58 |
<div class="statline">
|
|
@@ -62,20 +50,20 @@ footer{border-top:1px solid var(--line);color:var(--mut);font-size:11.5px;paddin
|
|
| 62 |
<span>Protocol: <b id="proto">—</b></span>
|
| 63 |
<span>Probe latency: <b id="lat">—</b></span>
|
| 64 |
</div>
|
| 65 |
-
<p class="sub" style="margin:12px 0 0">
|
| 66 |
</div>
|
| 67 |
|
| 68 |
-
<h2>Tools
|
| 69 |
-
<p class="sub">
|
| 70 |
-
<
|
| 71 |
|
| 72 |
<h2>Recent invocations</h2>
|
| 73 |
-
<p class="sub">
|
| 74 |
-
<
|
| 75 |
|
| 76 |
<h2>Connect a client</h2>
|
| 77 |
<div class="card">
|
| 78 |
-
<p style="margin:0 0 8px">Claude Desktop —
|
| 79 |
<pre>{
|
| 80 |
"mcpServers": {
|
| 81 |
"szl-a11oy": {
|
|
@@ -84,61 +72,63 @@ footer{border-top:1px solid var(--line);color:var(--mut);font-size:11.5px;paddin
|
|
| 84 |
}
|
| 85 |
}
|
| 86 |
}</pre>
|
| 87 |
-
<p class="sub" style="margin:8px 0 0">
|
| 88 |
</div>
|
| 89 |
|
| 90 |
-
<div class="note">
|
| 91 |
-
<p class="sub">Source:
|
| 92 |
|
| 93 |
<script>
|
| 94 |
-
const BASE="";
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
]
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
document.getElementById('toolcount').textContent=list.length;}
|
| 112 |
-
paintTools(
|
| 113 |
|
|
|
|
| 114 |
const t0=performance.now();
|
| 115 |
-
fetch(BASE+"/mcp/"
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
document.getElementById('
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
|
|
|
|
|
|
|
|
|
| 122 |
}
|
| 123 |
-
}).catch(()=>{
|
| 124 |
-
|
| 125 |
-
fetch(BASE+"/api/hatun/evidence",{cache:'no-store'}).then(r=>r.ok?r.json():Promise.reject()).then(e=>{
|
| 126 |
-
const signer=e&&e.signer||{};const chain=e&&e.receipt_chain||{};
|
| 127 |
-
document.getElementById('signer').textContent=signer.status==='OBSERVED_VERIFIED'?(signer.label||'OBSERVED_VERIFIED'):(signer.status||'UNKNOWN');
|
| 128 |
-
document.getElementById('chain').textContent=chain.status||'UNKNOWN';
|
| 129 |
-
}).catch(()=>{document.getElementById('signer').textContent='UNAVAILABLE';document.getElementById('chain').textContent='UNAVAILABLE';});
|
| 130 |
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
const ev=cell('','td'),evCode=document.createElement('code');evCode.textContent=(x.signature_status||'UNKNOWN')+' · '+(x.receipt_hash||'').slice(0,16);ev.appendChild(evCode);tr.appendChild(ev);tb.appendChild(tr);});
|
| 140 |
-
}).catch(()=>{paintEmptyInvocation('UNAVAILABLE — the read-only invocation feed could not be read.');});
|
| 141 |
</script>
|
| 142 |
</main>
|
| 143 |
-
<footer>Doctrine v11
|
| 144 |
</body></html>
|
|
|
|
| 9 |
header{border-bottom:1px solid var(--line);padding:14px 22px;display:flex;align-items:center;gap:14px;background:linear-gradient(180deg,#10121b,#0a0b10)}
|
| 10 |
header .brand{font-weight:700;letter-spacing:.5px;color:var(--gold);font-size:18px}
|
| 11 |
header .tag{color:var(--mut);font-size:12px}
|
| 12 |
+
nav{display:flex;flex-wrap:wrap;gap:8px;padding:10px 22px;border-bottom:1px solid var(--line);background:var(--panel)}
|
| 13 |
nav a{font-size:12.5px;padding:4px 10px;border:1px solid var(--line);border-radius:999px;color:var(--mut)}
|
| 14 |
nav a:hover{border-color:var(--gold);color:var(--gold);text-decoration:none}
|
| 15 |
nav a.active{background:var(--gold);color:#0a0b10;border-color:var(--gold);font-weight:600}
|
|
|
|
| 22 |
.grid a.tile:hover{border-color:var(--gold);text-decoration:none}
|
| 23 |
.grid a.tile .t{color:var(--gold);font-weight:600;margin-bottom:4px}.grid a.tile .d{color:var(--mut);font-size:12.5px}
|
| 24 |
table{width:100%;border-collapse:collapse;margin:12px 0;font-size:13.5px}
|
|
|
|
|
|
|
| 25 |
th,td{text-align:left;padding:8px 10px;border-bottom:1px solid var(--line);vertical-align:top}
|
| 26 |
th{color:var(--mut);font-weight:600;font-size:12px;text-transform:uppercase;letter-spacing:.4px}
|
| 27 |
code,pre{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12.5px}
|
|
|
|
| 35 |
.statline b{color:var(--ink)}
|
| 36 |
.tag2{display:inline-block;background:#1c2030;color:var(--mut);border:1px solid var(--line);border-radius:6px;padding:1px 7px;font-size:11px;margin-left:6px}
|
| 37 |
.st{color:var(--amb);font-weight:600}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
</style></head><body>
|
| 39 |
<header><span class="brand">a11oy</span><span class="tag">Brand Orchestration Layer · the one place to see everything</span></header>
|
| 40 |
<nav><a href="/hub">Hub</a><a href="/a11oy.code">a11oy.code</a><a href="/docs">Docs</a><a href="/pricing">Pricing</a><a href="/api-keys">API Keys</a><a href="/sdk">SDK</a><a href="/status">Status</a><a href="/hatun-mcp" class="active">Hatun-MCP</a><a href="/observability">Observability</a><a href="/security">Security</a><a href="/compliance">Compliance</a><a href="/cued-engagement">Cued Engagement</a><a href="/uds">UDS</a><a href="/counter-uas">Counter-UAS</a><a href="/evidence">Evidence</a><a href="/upgrades">Upgrades</a><a href="/audit">Audit</a><a href="/gap-report">Gap Report</a></nav>
|
| 41 |
<main>
|
| 42 |
<h1>Hatun-MCP — agentic MCP server</h1>
|
| 43 |
+
<p class="sub"><b>Hatun</b> (Quechua: <i>great / sovereign</i>) is the Model Context Protocol gateway that exposes SZL's governed flagship capabilities to any MCP client (Claude Desktop, Cursor, custom agents). Every tool invocation passes the Yuyay-13 governance gate and emits a signed Khipu receipt. Anonymous calls are governed-but-declined (OWASP MCP07) — provide an SZL API key to execute. This tab probes the live server directly from your browser.</p>
|
| 44 |
|
| 45 |
<div class="card">
|
| 46 |
<div class="statline">
|
|
|
|
| 50 |
<span>Protocol: <b id="proto">—</b></span>
|
| 51 |
<span>Probe latency: <b id="lat">—</b></span>
|
| 52 |
</div>
|
| 53 |
+
<p class="sub" style="margin:12px 0 0">Endpoint: <code>https://szlholdings-a11oy.hf.space/mcp/</code> (canonical, live, same-origin) · Transport: JSON-RPC over Streamable HTTP (<code>POST /mcp/</code>) · MCP revision <code>2024-11-05</code><br><b>Note:</b> the standalone hatun-mcp Space is retired; a11oy now serves the canonical MCP directly at <code>/mcp/</code>.</p>
|
| 54 |
</div>
|
| 55 |
|
| 56 |
+
<h2>Tools exposed (<span id="toolcount">16</span>)</h2>
|
| 57 |
+
<p class="sub">Loaded live from the canonical <code>GET /mcp/</code> discovery card on this Space. These are the real governed tools exposed by the live MCP (call them with <code>POST /mcp/</code> JSON-RPC <code>tools/call</code>).</p>
|
| 58 |
+
<table><thead><tr><th>Tool</th><th>Backend flagship</th><th>Class</th></tr></thead><tbody id="tools"></tbody></table>
|
| 59 |
|
| 60 |
<h2>Recent invocations</h2>
|
| 61 |
+
<p class="sub">Each MCP call appends a Khipu receipt (continuum hash + DSSE signature) to the governance chain. Recent receipts are summarized here from the server's invocation feed; if the feed endpoint is unreachable cross-origin it shows the honest interim message below.</p>
|
| 62 |
+
<table><thead><tr><th>Time (UTC)</th><th>Tool</th><th>Outcome</th><th>Continuum hash</th></tr></thead><tbody id="inv"><tr><td colspan="4" class="sub">loading…</td></tr></tbody></table>
|
| 63 |
|
| 64 |
<h2>Connect a client</h2>
|
| 65 |
<div class="card">
|
| 66 |
+
<p style="margin:0 0 8px">Claude Desktop — add to <code>claude_desktop_config.json</code> (uses the <code>mcp-remote</code> bridge, pointing at a11oy's live canonical <code>/mcp/</code>):</p>
|
| 67 |
<pre>{
|
| 68 |
"mcpServers": {
|
| 69 |
"szl-a11oy": {
|
|
|
|
| 72 |
}
|
| 73 |
}
|
| 74 |
}</pre>
|
| 75 |
+
<p class="sub" style="margin:8px 0 0">Quick test: <code>curl -s https://szlholdings-a11oy.hf.space/mcp/</code> (discovery card) or <code>curl -s -X POST https://szlholdings-a11oy.hf.space/mcp/ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'</code> · public key: <a href="/cosign.pub" target="_blank" rel="noopener">/cosign.pub</a> · try the loop: <a href="/ask-and-act">/ask-and-act</a></p>
|
| 76 |
</div>
|
| 77 |
|
| 78 |
+
<div class="note">This tab probes a11oy's own canonical, same-origin <code>/mcp/</code> endpoint — no cross-origin CORS, no dead Space. The tool list and protocol version below are read live from <code>GET /mcp/</code>.</div>
|
| 79 |
+
<p class="sub">Source: szl_agentic_loop.py (canonical MCP + governed loop) · live probe of <code>/mcp/</code></p>
|
| 80 |
|
| 81 |
<script>
|
| 82 |
+
const BASE=""; // same-origin: a11oy serves the canonical /mcp/ directly
|
| 83 |
+
// Static authoritative tool list (mirrors server-card.json); refreshed live below when CORS permits.
|
| 84 |
+
const TOOLS=[
|
| 85 |
+
["szl_a11oy_code_chat","a11oy.code","read"],
|
| 86 |
+
["szl_killinchu_detect","vessels / killinchu","read"],
|
| 87 |
+
["szl_killinchu_cue","vessels / killinchu","2-person"],
|
| 88 |
+
["szl_sentra_scan","sentra","read"],
|
| 89 |
+
["szl_rosie_reason","rosie","read"],
|
| 90 |
+
["szl_khipu_verify","governance","read"],
|
| 91 |
+
["szl_lean_verify","lean / formal-verification","read"],
|
| 92 |
+
["szl_puriq_evaluate","puriq","read"],
|
| 93 |
+
["szl_yachay_dome_predict","yachay-dome","read"],
|
| 94 |
+
["szl_wayra_recent","wayra","read"],
|
| 95 |
+
["szl_anatomy_3d_render","anatomy","read"],
|
| 96 |
+
["szl_doctrine_lookup","governance / doctrine","read"],
|
| 97 |
+
["szl_yuyay_score","yuyay-v3","read"],
|
| 98 |
+
["szl_thesis_query","thesis","read"],
|
| 99 |
+
["szl_drone_lookup","uds / counter-uas","read"],
|
| 100 |
+
["szl_formula_evaluate","puriq / formal math","read"]];
|
| 101 |
+
function paintTools(list){const tb=document.getElementById('tools');tb.innerHTML='';
|
| 102 |
+
list.forEach(([n,b,c])=>{const tr=document.createElement('tr');
|
| 103 |
+
const cls=c==='2-person'?'a':'n';
|
| 104 |
+
tr.innerHTML=`<td><code>${n}</code></td><td>${b}</td><td><span class="pill ${cls}">${c}</span></td>`;tb.appendChild(tr);});
|
| 105 |
document.getElementById('toolcount').textContent=list.length;}
|
| 106 |
+
paintTools(TOOLS);
|
| 107 |
|
| 108 |
+
// Live probe of the canonical, same-origin /mcp/ discovery card
|
| 109 |
const t0=performance.now();
|
| 110 |
+
fetch(BASE+"/mcp/").then(r=>r.json().then(j=>({r,j}))).then(({r,j})=>{
|
| 111 |
+
const ms=Math.round(performance.now()-t0);
|
| 112 |
+
document.getElementById('lat').textContent=ms+' ms';
|
| 113 |
+
document.getElementById('health').innerHTML=(r.ok&&j.canonical)?'<span class="pill g">LIVE</span>':'<span class="pill a">'+r.status+'</span>';
|
| 114 |
+
document.getElementById('signer').textContent='in-image ECDSA-P256 (see /cosign.pub)';
|
| 115 |
+
document.getElementById('chain').textContent='hash-chained receipts ✓';
|
| 116 |
+
document.getElementById('proto').textContent=j.protocolVersion||'—';
|
| 117 |
+
// refresh the tool table from the live card's real governed tools
|
| 118 |
+
if(j&&Array.isArray(j.tools)&&j.tools.length){
|
| 119 |
+
paintTools(j.tools.map(t=>[t.name, (t.title||'governed tool'), 'governed']));
|
| 120 |
}
|
| 121 |
+
}).catch(()=>{document.getElementById('health').innerHTML='<span class="pill r">unreachable</span>';});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
+
// Recent invocations feed (optional endpoint; honest fallback if absent/blocked)
|
| 124 |
+
fetch(BASE+"/api/hatun/invocations",{mode:'cors'}).then(r=>r.ok?r.json():Promise.reject()).then(rows=>{
|
| 125 |
+
const tb=document.getElementById('inv');tb.innerHTML='';
|
| 126 |
+
if(!rows||!rows.length){tb.innerHTML='<tr><td colspan="4" class="sub">No recent invocations recorded.</td></tr>';return;}
|
| 127 |
+
rows.slice(0,12).forEach(x=>{const tr=document.createElement('tr');
|
| 128 |
+
const ok=x.outcome==='success';
|
| 129 |
+
tr.innerHTML=`<td>${x.ts||'—'}</td><td><code>${x.tool||'—'}</code></td><td><span class="pill ${ok?'g':'a'}">${x.outcome||'—'}</span></td><td><code>${(x.continuum_hash||'').slice(0,16)}</code></td>`;tb.appendChild(tr);});
|
| 130 |
+
}).catch(()=>{document.getElementById('inv').innerHTML='<tr><td colspan="4" class="sub">Run a governed agent at <a href="/ask-and-act">/ask-and-act</a> — each run produces a signed, hash-chained receipt you can re-verify in the browser (chain + signature). The MCP <code>tools/call</code> path drives the same governed pipeline.</td></tr>';});
|
|
|
|
|
|
|
| 131 |
</script>
|
| 132 |
</main>
|
| 133 |
+
<footer>Doctrine v12 (PURIQ) additive · v11/v12 LOCKED: 749 declarations · 14 axioms · 163 sorries · 13-axis yuyay_v3 · lutar-v18.0.0 @ c7c0ba17 · SLSA L1 (honest) · Khipu signature = DSSE/cosign PLACEHOLDER<br>HfApi direct push only · IP-HOLD a11oy#57 untouched · ADDITIVE / zero-regression · Khipu receipt on every action · Signed <b>Yachay</b> · Co-author Perplexity Computer Agent</footer>
|
| 134 |
</body></html>
|
serve.py
CHANGED
|
@@ -77,13 +77,8 @@ def gov_envelope(payload=None, status="REAL", citations=None, reason=None, **ext
|
|
| 77 |
return out
|
| 78 |
# === END GOVERNED ENVELOPE ===
|
| 79 |
|
| 80 |
-
# RESET:
|
| 81 |
-
|
| 82 |
-
# than trying to return a container-only path (which turns an otherwise honest
|
| 83 |
-
# 404 or history fallback into a 500).
|
| 84 |
-
_IMAGE_STATIC_DIR = Path("/app/static")
|
| 85 |
-
_LOCAL_STATIC_DIR = Path(__file__).resolve().parent / "console"
|
| 86 |
-
STATIC_DIR = _IMAGE_STATIC_DIR if (_IMAGE_STATIC_DIR / "index.html").is_file() else _LOCAL_STATIC_DIR
|
| 87 |
ASSETS_DIR = STATIC_DIR / "assets"
|
| 88 |
INDEX_HTML = STATIC_DIR / "index.html"
|
| 89 |
A11OY_BACKEND_PORT = 8081
|
|
@@ -1825,18 +1820,6 @@ try:
|
|
| 1825 |
except Exception as _szl_gq_e: # pragma: no cover
|
| 1826 |
print(f"[a11oy] GPU-Quant engine NOT registered: {_szl_gq_e!r}", file=__import__("sys").stderr)
|
| 1827 |
|
| 1828 |
-
# -- EvidenceOS involution probe: bounded clean-room boundary/bulk decomposition.
|
| 1829 |
-
# The endpoint requires a caller-declared finite involution, performs no writes or
|
| 1830 |
-
# effectors, and returns a content digest plus explicit PROVEN/MODELED/REPORTED scope.
|
| 1831 |
-
try:
|
| 1832 |
-
import szl_involution_probe as _szl_involution_probe
|
| 1833 |
-
_szl_involution_probe.register(app, ns="a11oy")
|
| 1834 |
-
print("[a11oy] EvidenceOS involution probe registered: /api/a11oy/v1/evidenceos/involution/*",
|
| 1835 |
-
file=__import__("sys").stderr)
|
| 1836 |
-
except Exception as _szl_involution_e: # pragma: no cover
|
| 1837 |
-
print(f"[a11oy] EvidenceOS involution probe NOT registered: {_szl_involution_e!r}",
|
| 1838 |
-
file=__import__("sys").stderr)
|
| 1839 |
-
|
| 1840 |
# ── Agentic PINN + Physical-Bounds Certifier MESH (pinn-bounds) — closes the audited
|
| 1841 |
# gap where the PINN / FE-NO Physics-ML verticals lived ONLY in `platform` and were
|
| 1842 |
# NOT in a11oy's governed /api/a11oy/v1/<name> route table. Adds /api/a11oy/v1/pinn/*:
|
|
@@ -3272,18 +3255,6 @@ except Exception as _vsp_e:
|
|
| 3272 |
print(f"[a11oy] vsp-otel VSP skipped: {_vsp_e!r}", file=_vsp_sys.stderr)
|
| 3273 |
# --- end vsp-otel VSP ---
|
| 3274 |
|
| 3275 |
-
# -- Runtime contracts: process liveness, fail-closed readiness, build identity,
|
| 3276 |
-
# explicit OTEL exporter/collector evidence, and soft-404 protection for unknown
|
| 3277 |
-
# file-like discovery paths. Read-only GETs; no receipt minting or external calls.
|
| 3278 |
-
try:
|
| 3279 |
-
import szl_runtime_contracts as _szl_runtime_contracts
|
| 3280 |
-
_runtime_contracts_status = _szl_runtime_contracts.register(app, ns="a11oy")
|
| 3281 |
-
print(f"[a11oy] Runtime contracts registered: {_runtime_contracts_status}",
|
| 3282 |
-
file=__import__("sys").stderr)
|
| 3283 |
-
except Exception as _runtime_contracts_e: # pragma: no cover
|
| 3284 |
-
print(f"[a11oy] Runtime contracts NOT registered: {_runtime_contracts_e!r}",
|
| 3285 |
-
file=__import__("sys").stderr)
|
| 3286 |
-
|
| 3287 |
|
| 3288 |
# ── Live 3D Wires (PURIQ / Doctrine v12) — ADDITIVE, re-pinned FIRST ─────────
|
| 3289 |
# Registered immediately after the app is constructed so FastAPI's ordered route
|
|
@@ -3491,9 +3462,7 @@ except Exception as _sec_hdr_e: # pragma: no cover
|
|
| 3491 |
# ===========================================================================
|
| 3492 |
from fastapi.responses import RedirectResponse as _PTG_Redirect
|
| 3493 |
|
| 3494 |
-
|
| 3495 |
-
_PTG_LOCAL_WEB = Path(__file__).resolve().parent / "web"
|
| 3496 |
-
_PTG_WEB = _PTG_IMAGE_WEB if _PTG_IMAGE_WEB.is_dir() else _PTG_LOCAL_WEB
|
| 3497 |
|
| 3498 |
def _ptg_serve(filename: str):
|
| 3499 |
async def _h() -> Response:
|
|
|
|
| 77 |
return out
|
| 78 |
# === END GOVERNED ENVELOPE ===
|
| 79 |
|
| 80 |
+
# RESET: SPA is served from /app/static (repo root mirrors dist/public). No /console subdir.
|
| 81 |
+
STATIC_DIR = Path("/app/static")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
ASSETS_DIR = STATIC_DIR / "assets"
|
| 83 |
INDEX_HTML = STATIC_DIR / "index.html"
|
| 84 |
A11OY_BACKEND_PORT = 8081
|
|
|
|
| 1820 |
except Exception as _szl_gq_e: # pragma: no cover
|
| 1821 |
print(f"[a11oy] GPU-Quant engine NOT registered: {_szl_gq_e!r}", file=__import__("sys").stderr)
|
| 1822 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1823 |
# ── Agentic PINN + Physical-Bounds Certifier MESH (pinn-bounds) — closes the audited
|
| 1824 |
# gap where the PINN / FE-NO Physics-ML verticals lived ONLY in `platform` and were
|
| 1825 |
# NOT in a11oy's governed /api/a11oy/v1/<name> route table. Adds /api/a11oy/v1/pinn/*:
|
|
|
|
| 3255 |
print(f"[a11oy] vsp-otel VSP skipped: {_vsp_e!r}", file=_vsp_sys.stderr)
|
| 3256 |
# --- end vsp-otel VSP ---
|
| 3257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3258 |
|
| 3259 |
# ── Live 3D Wires (PURIQ / Doctrine v12) — ADDITIVE, re-pinned FIRST ─────────
|
| 3260 |
# Registered immediately after the app is constructed so FastAPI's ordered route
|
|
|
|
| 3462 |
# ===========================================================================
|
| 3463 |
from fastapi.responses import RedirectResponse as _PTG_Redirect
|
| 3464 |
|
| 3465 |
+
_PTG_WEB = Path("/app/web")
|
|
|
|
|
|
|
| 3466 |
|
| 3467 |
def _ptg_serve(filename: str):
|
| 3468 |
async def _h() -> Response:
|
szl_agentic_loop.py
CHANGED
|
@@ -10,11 +10,9 @@
|
|
| 10 |
# chained, signed receipt.
|
| 11 |
#
|
| 12 |
# WHAT IT EXPOSES (all registered BEFORE the SPA catch-all via routes.insert(0)):
|
| 13 |
-
# GET /mcp/ — MCP
|
| 14 |
# POST /mcp/ — MCP JSON-RPC (initialize, tools/list, tools/call)
|
| 15 |
# GET /api/<ns>/v1/agent/tools — plain tool catalog (mirror of MCP tools/list)
|
| 16 |
-
# GET /api/<ns>/v1/agent/evidence — observed, read-only receipt evidence
|
| 17 |
-
# GET /api/<ns>/v1/agent/invocations — bounded, ephemeral receipt summaries
|
| 18 |
# POST /api/<ns>/v1/agent/run — the GOVERNED AGENT RUN (the whole loop)
|
| 19 |
# POST /api/<ns>/v1/agent/verify-chain— re-verify a run's chained receipt
|
| 20 |
# GET /ask-and-act — the consumer/investor UI (one button)
|
|
@@ -38,17 +36,10 @@ from __future__ import annotations
|
|
| 38 |
import hashlib
|
| 39 |
import json
|
| 40 |
import math
|
| 41 |
-
import threading
|
| 42 |
import time
|
| 43 |
import uuid
|
| 44 |
from datetime import datetime, timezone
|
| 45 |
|
| 46 |
-
|
| 47 |
-
# The Hatun read surface exposes only a bounded, in-process summary of receipts
|
| 48 |
-
# that this module actually observed creating. It is deliberately ephemeral: a
|
| 49 |
-
# restart clears the feed, and no GET handler signs or appends anything.
|
| 50 |
-
_HATUN_FEED_LIMIT = 32
|
| 51 |
-
|
| 52 |
# ----------------------------------------------------------------------------
|
| 53 |
# FORMULA WIRING (ADDITIVE 2026-06-06): the ~80 kernel-verified theorems wired
|
| 54 |
# to REAL work. szl_formula_wiring exposes deterministic mechanisms that COMPUTE
|
|
@@ -756,14 +747,9 @@ def register(app, ns: str, sign_fn, verify_fn=None, pub_pem_fn=None,
|
|
| 756 |
from starlette.responses import JSONResponse, HTMLResponse
|
| 757 |
from starlette.requests import Request
|
| 758 |
|
| 759 |
-
#
|
| 760 |
_RUN_CHAIN = [] # list of {run_id, final_hash, prev_run_hash}
|
| 761 |
|
| 762 |
-
# Bounded read model derived only from receipts created by _do_run. This is
|
| 763 |
-
# not a durable ledger and it is never populated by a GET request.
|
| 764 |
-
_HATUN_EVIDENCE = []
|
| 765 |
-
_HATUN_EVIDENCE_LOCK = threading.Lock()
|
| 766 |
-
|
| 767 |
def _do_run(query: str, action: str, severity: str, confidence: float,
|
| 768 |
reversible: bool, untrusted_input: str = "", approval_grant=None,
|
| 769 |
precondition_hash=None):
|
|
@@ -837,7 +823,7 @@ def register(app, ns: str, sign_fn, verify_fn=None, pub_pem_fn=None,
|
|
| 837 |
"quarantined": True,
|
| 838 |
"feeds_decision": False})
|
| 839 |
|
| 840 |
-
# ---- HOP 3: MCP tool-call (policy_check tool, via the
|
| 841 |
with tr.span("tool_call", "mcp") as sp:
|
| 842 |
tool_name = "policy_check"
|
| 843 |
tool_input = {"action": action, "severity": severity,
|
|
@@ -1037,7 +1023,6 @@ def register(app, ns: str, sign_fn, verify_fn=None, pub_pem_fn=None,
|
|
| 1037 |
sealed = _chain_receipt("emit", {"decision": decision,
|
| 1038 |
"emitted": effect["emitted"],
|
| 1039 |
"signed": bool(envelope.get("signed"))})
|
| 1040 |
-
receipt_has_signature = bool(envelope.get("signed") and envelope.get("signatures"))
|
| 1041 |
|
| 1042 |
# ---- OPERATOR + GRAPH + UNIFYING FORMULA WIRING (real, executed on the
|
| 1043 |
# ---- SEALED chain) — these mechanisms run on the actual receipts below.
|
|
@@ -1103,12 +1088,11 @@ def register(app, ns: str, sign_fn, verify_fn=None, pub_pem_fn=None,
|
|
| 1103 |
"decision": decision}
|
| 1104 |
_RUN_CHAIN.append(run_record)
|
| 1105 |
|
| 1106 |
-
|
| 1107 |
"run_id": tr.trace_id,
|
| 1108 |
"decision": decision,
|
| 1109 |
"emitted": effect["emitted"],
|
| 1110 |
-
"summary": _plain_summary(decision, action, effect, reasons, trust, trust_pass,
|
| 1111 |
-
receipt_has_signature),
|
| 1112 |
"retrieved": chunks,
|
| 1113 |
"untrusted": {"present": bool(untrusted_input),
|
| 1114 |
"excerpt": (untrusted_input or "")[:240],
|
|
@@ -1134,34 +1118,25 @@ def register(app, ns: str, sign_fn, verify_fn=None, pub_pem_fn=None,
|
|
| 1134 |
"signed_receipt": envelope,
|
| 1135 |
"chain_final_hash": prev_hash,
|
| 1136 |
"chain_depth": len(chain),
|
| 1137 |
-
"signer": signer_label
|
| 1138 |
-
"signer_claim_status": ("SIGNATURE_PRESENT_UNVERIFIED"
|
| 1139 |
-
if receipt_has_signature else "UNAVAILABLE"),
|
| 1140 |
"verify_hint": ("Re-verify with POST /api/%s/v1/agent/verify-chain "
|
| 1141 |
-
"(send the whole run object back).
|
| 1142 |
-
"
|
| 1143 |
"doctrine": "v11",
|
| 1144 |
"honesty": ("Trust score is advisory (Conjecture 1). RAG retrieves over the "
|
| 1145 |
-
"in-image governance corpus.
|
| 1146 |
-
% ("PRESENT_UNVERIFIED" if receipt_has_signature else "UNAVAILABLE")),
|
| 1147 |
}
|
| 1148 |
-
|
| 1149 |
-
|
| 1150 |
-
|
| 1151 |
-
def _plain_summary(decision, action, effect, reasons, trust, trust_pass,
|
| 1152 |
-
receipt_has_signature):
|
| 1153 |
-
receipt_note = ("A receipt envelope with signature bytes was produced; verification "
|
| 1154 |
-
"is a separate check." if receipt_has_signature else
|
| 1155 |
-
"The receipt is UNSIGNED because no signature evidence was available.")
|
| 1156 |
if decision == "ALLOW":
|
| 1157 |
return ("Allowed. After retrieving the relevant guidance, calling the policy "
|
| 1158 |
"tool, passing the safety gate and the advisory trust check (score "
|
| 1159 |
-
"%.2f), the action \"%s\" was %s.
|
| 1160 |
-
% (trust, action, effect["effect"]
|
| 1161 |
why = "; ".join(reasons) if reasons else ("advisory trust score %.2f below the floor" % trust)
|
| 1162 |
return ("Blocked. The safety/trust gate denied \"%s\" because: %s. No action was "
|
| 1163 |
-
"taken
|
| 1164 |
-
% (action, why
|
| 1165 |
|
| 1166 |
def _verify_chain(run: dict):
|
| 1167 |
"""Re-verify a run object: (1) chain integrity (each prev_hash links and each
|
|
@@ -1213,122 +1188,6 @@ def register(app, ns: str, sign_fn, verify_fn=None, pub_pem_fn=None,
|
|
| 1213 |
"Flip any byte in any receipt body and chain_intact becomes false."),
|
| 1214 |
}
|
| 1215 |
|
| 1216 |
-
def _signature_evidence_status(run: dict, verification: dict) -> str:
|
| 1217 |
-
"""Classify only evidence present on an observed receipt.
|
| 1218 |
-
|
| 1219 |
-
A self-reported ``signed`` flag is not enough to call a signature
|
| 1220 |
-
verified. Verification requires the host-provided verifier to have run
|
| 1221 |
-
and returned a positive result.
|
| 1222 |
-
"""
|
| 1223 |
-
envelope = run.get("signed_receipt") or {}
|
| 1224 |
-
has_signature = bool(envelope.get("signed") and envelope.get("signatures"))
|
| 1225 |
-
if (verify_fn is not None and has_signature
|
| 1226 |
-
and verification.get("signature_valid") is True):
|
| 1227 |
-
return "VERIFIED"
|
| 1228 |
-
if verify_fn is not None and has_signature:
|
| 1229 |
-
return "INVALID"
|
| 1230 |
-
if has_signature:
|
| 1231 |
-
return "PRESENT_UNVERIFIED"
|
| 1232 |
-
return "UNAVAILABLE"
|
| 1233 |
-
|
| 1234 |
-
def _remember_hatun_receipt(run: dict, decision_payload: dict, tool_name: str) -> None:
|
| 1235 |
-
"""Append a bounded, redacted summary of an actual governed-run receipt."""
|
| 1236 |
-
verification = _verify_chain(run)
|
| 1237 |
-
signature_status = _signature_evidence_status(run, verification)
|
| 1238 |
-
if run.get("decision") == "DENY":
|
| 1239 |
-
outcome = "DENY"
|
| 1240 |
-
elif run.get("emitted"):
|
| 1241 |
-
outcome = "ALLOW_EMITTED"
|
| 1242 |
-
else:
|
| 1243 |
-
outcome = "ALLOW_HELD"
|
| 1244 |
-
entry = {
|
| 1245 |
-
"namespace": ns,
|
| 1246 |
-
"ts": decision_payload.get("issued_at"),
|
| 1247 |
-
"run_id": run.get("run_id"),
|
| 1248 |
-
"source": "governed_agent_run_receipt",
|
| 1249 |
-
"tool": tool_name,
|
| 1250 |
-
"outcome": outcome,
|
| 1251 |
-
"receipt_hash": run.get("chain_final_hash"),
|
| 1252 |
-
"chain_depth": run.get("chain_depth"),
|
| 1253 |
-
"chain_status": ("OBSERVED_INTACT"
|
| 1254 |
-
if verification.get("chain_intact") is True
|
| 1255 |
-
else "OBSERVED_BROKEN"),
|
| 1256 |
-
"signature_status": signature_status,
|
| 1257 |
-
"signer": signer_label if signature_status == "VERIFIED" else None,
|
| 1258 |
-
"maturity": "OBSERVED",
|
| 1259 |
-
}
|
| 1260 |
-
with _HATUN_EVIDENCE_LOCK:
|
| 1261 |
-
_HATUN_EVIDENCE.append(entry)
|
| 1262 |
-
overflow = len(_HATUN_EVIDENCE) - _HATUN_FEED_LIMIT
|
| 1263 |
-
if overflow > 0:
|
| 1264 |
-
del _HATUN_EVIDENCE[:overflow]
|
| 1265 |
-
|
| 1266 |
-
def _hatun_invocation_contract() -> dict:
|
| 1267 |
-
with _HATUN_EVIDENCE_LOCK:
|
| 1268 |
-
items = [dict(item) for item in reversed(_HATUN_EVIDENCE)]
|
| 1269 |
-
return {
|
| 1270 |
-
"schema": "szl.hatun.invocation-feed.v1",
|
| 1271 |
-
"namespace": ns,
|
| 1272 |
-
"status": "OBSERVED" if items else "UNKNOWN",
|
| 1273 |
-
"read_only": True,
|
| 1274 |
-
"get_mints_receipt": False,
|
| 1275 |
-
"ephemeral": True,
|
| 1276 |
-
"limit": _HATUN_FEED_LIMIT,
|
| 1277 |
-
"count": len(items),
|
| 1278 |
-
"source": "bounded in-process summaries of actual governed agent-run receipts",
|
| 1279 |
-
"items": items,
|
| 1280 |
-
}
|
| 1281 |
-
|
| 1282 |
-
def _hatun_evidence_contract() -> dict:
|
| 1283 |
-
feed = _hatun_invocation_contract()
|
| 1284 |
-
items = feed["items"]
|
| 1285 |
-
latest = items[0] if items else None
|
| 1286 |
-
verified = next((item for item in items
|
| 1287 |
-
if item.get("signature_status") == "VERIFIED"), None)
|
| 1288 |
-
if verified:
|
| 1289 |
-
signer = {"status": "OBSERVED_VERIFIED", "label": verified.get("signer")}
|
| 1290 |
-
elif any(item.get("signature_status") in ("PRESENT_UNVERIFIED", "INVALID")
|
| 1291 |
-
for item in items):
|
| 1292 |
-
signer = {"status": "UNVERIFIED", "label": None}
|
| 1293 |
-
elif items:
|
| 1294 |
-
signer = {"status": "UNAVAILABLE", "label": None}
|
| 1295 |
-
else:
|
| 1296 |
-
signer = {"status": "UNKNOWN", "label": None}
|
| 1297 |
-
|
| 1298 |
-
return {
|
| 1299 |
-
"schema": "szl.hatun.evidence.v1",
|
| 1300 |
-
"namespace": ns,
|
| 1301 |
-
"read_only": True,
|
| 1302 |
-
"get_mints_receipt": False,
|
| 1303 |
-
"runtime": {
|
| 1304 |
-
"status": "AVAILABLE",
|
| 1305 |
-
"mcp_endpoint": "/mcp/",
|
| 1306 |
-
"protocol_version": "2024-11-05",
|
| 1307 |
-
},
|
| 1308 |
-
"tool_catalog": {
|
| 1309 |
-
"status": "RUNTIME_DECLARED",
|
| 1310 |
-
"count": len(_tool_catalog(ns)),
|
| 1311 |
-
"evidence_boundary": "declaration and route presence; not execution proof",
|
| 1312 |
-
},
|
| 1313 |
-
"signer": signer,
|
| 1314 |
-
"receipt_chain": {
|
| 1315 |
-
"status": latest.get("chain_status") if latest else "UNKNOWN",
|
| 1316 |
-
"observed_receipts": len(items),
|
| 1317 |
-
"latest_receipt_hash": latest.get("receipt_hash") if latest else None,
|
| 1318 |
-
"latest_chain_depth": latest.get("chain_depth") if latest else None,
|
| 1319 |
-
},
|
| 1320 |
-
"invocations": {
|
| 1321 |
-
"status": feed["status"],
|
| 1322 |
-
"count": feed["count"],
|
| 1323 |
-
"ephemeral": True,
|
| 1324 |
-
"endpoint": "/api/hatun/invocations" if ns == "a11oy"
|
| 1325 |
-
else "/api/%s/v1/agent/invocations" % ns,
|
| 1326 |
-
},
|
| 1327 |
-
"honesty": ("No receipt or signer claim is promoted by this GET. UNKNOWN and "
|
| 1328 |
-
"UNAVAILABLE remain visible until an observed governed run supplies "
|
| 1329 |
-
"the corresponding evidence."),
|
| 1330 |
-
}
|
| 1331 |
-
|
| 1332 |
# ------------------------------------------------------------------ #
|
| 1333 |
# OUROBOROS CLOSED LOOP (ADDITIVE 2026-07-03, default-OFF, honest).
|
| 1334 |
# Wraps the single governed pass `_do_run` into a BOUNDED, WITNESSED,
|
|
@@ -1539,7 +1398,7 @@ def register(app, ns: str, sign_fn, verify_fn=None, pub_pem_fn=None,
|
|
| 1539 |
except Exception: # pragma: no cover - SGH must never take the cycle down
|
| 1540 |
return core
|
| 1541 |
|
| 1542 |
-
# ---- MCP JSON-RPC handler (
|
| 1543 |
async def _mcp_post(request: Request):
|
| 1544 |
try:
|
| 1545 |
body = await request.json()
|
|
@@ -1637,21 +1496,18 @@ def register(app, ns: str, sign_fn, verify_fn=None, pub_pem_fn=None,
|
|
| 1637 |
return {"_error": True, "detail": "unknown tool: %s" % name}
|
| 1638 |
|
| 1639 |
async def _mcp_get(request: Request):
|
| 1640 |
-
#
|
| 1641 |
-
# list remains a runtime declaration, not proof of tool execution.
|
| 1642 |
return JSONResponse({
|
| 1643 |
"name": "szl-%s-mcp" % ns,
|
| 1644 |
-
"title": "SZL %s — governed MCP
|
| 1645 |
"protocol": "Model Context Protocol (JSON-RPC over Streamable HTTP)",
|
| 1646 |
"protocolVersion": "2024-11-05",
|
| 1647 |
"transport": {"post": "/mcp/ (JSON-RPC: initialize, tools/list, tools/call)"},
|
| 1648 |
"tools": _tool_catalog(ns),
|
| 1649 |
"tool_count": len(_tool_catalog(ns)),
|
| 1650 |
-
"
|
| 1651 |
-
"
|
| 1652 |
-
|
| 1653 |
-
"note": ("This GET confirms route reachability and returns the catalog declared "
|
| 1654 |
-
"by this runtime. It does not prove a tool ran or a receipt was signed."),
|
| 1655 |
"doctrine": "v11",
|
| 1656 |
})
|
| 1657 |
|
|
@@ -1673,17 +1529,7 @@ def register(app, ns: str, sign_fn, verify_fn=None, pub_pem_fn=None,
|
|
| 1673 |
|
| 1674 |
async def _agent_tools(request: Request):
|
| 1675 |
return JSONResponse({"tools": _tool_catalog(ns), "count": len(_tool_catalog(ns)),
|
| 1676 |
-
"
|
| 1677 |
-
"catalog_evidence": "RUNTIME_DECLARED",
|
| 1678 |
-
"doctrine": "v11"})
|
| 1679 |
-
|
| 1680 |
-
async def _agent_evidence(request: Request):
|
| 1681 |
-
return JSONResponse(_hatun_evidence_contract(),
|
| 1682 |
-
headers={"Cache-Control": "no-store"})
|
| 1683 |
-
|
| 1684 |
-
async def _agent_invocations(request: Request):
|
| 1685 |
-
return JSONResponse(_hatun_invocation_contract(),
|
| 1686 |
-
headers={"Cache-Control": "no-store"})
|
| 1687 |
|
| 1688 |
async def _agent_governance_standards(request: Request):
|
| 1689 |
return JSONResponse(governance_standards_note())
|
|
@@ -1749,10 +1595,6 @@ def register(app, ns: str, sign_fn, verify_fn=None, pub_pem_fn=None,
|
|
| 1749 |
Route("/mcp", _mcp_any, methods=["GET", "POST"], name="%s_mcp_noslash" % ns),
|
| 1750 |
Route("/api/%s/v1/agent/run" % ns, _agent_run, methods=["POST"], name="%s_agent_run" % ns),
|
| 1751 |
Route("/api/%s/v1/agent/tools" % ns, _agent_tools, methods=["GET"], name="%s_agent_tools" % ns),
|
| 1752 |
-
Route("/api/%s/v1/agent/evidence" % ns, _agent_evidence,
|
| 1753 |
-
methods=["GET"], name="%s_agent_evidence" % ns),
|
| 1754 |
-
Route("/api/%s/v1/agent/invocations" % ns, _agent_invocations,
|
| 1755 |
-
methods=["GET"], name="%s_agent_invocations" % ns),
|
| 1756 |
Route("/api/%s/v1/agent/governance-standards" % ns, _agent_governance_standards,
|
| 1757 |
methods=["GET"], name="%s_agent_gov_standards" % ns),
|
| 1758 |
Route("/api/%s/v1/agent/verify-chain" % ns, _agent_verify, methods=["POST"], name="%s_agent_verify" % ns),
|
|
@@ -1760,13 +1602,6 @@ def register(app, ns: str, sign_fn, verify_fn=None, pub_pem_fn=None,
|
|
| 1760 |
Route("/ask-and-act", _ask_and_act_ui, methods=["GET"], name="%s_ask_and_act" % ns),
|
| 1761 |
Route("/governed-run", _ask_and_act_ui, methods=["GET"], name="%s_governed_run" % ns),
|
| 1762 |
]
|
| 1763 |
-
if ns == "a11oy":
|
| 1764 |
-
routes.extend([
|
| 1765 |
-
Route("/api/hatun/evidence", _agent_evidence, methods=["GET"],
|
| 1766 |
-
name="hatun_evidence"),
|
| 1767 |
-
Route("/api/hatun/invocations", _agent_invocations, methods=["GET"],
|
| 1768 |
-
name="hatun_invocations"),
|
| 1769 |
-
])
|
| 1770 |
# insert at position 0 so they win over the SPA catch-all (the known gotcha).
|
| 1771 |
for r in reversed(routes):
|
| 1772 |
app.router.routes.insert(0, r)
|
|
|
|
| 10 |
# chained, signed receipt.
|
| 11 |
#
|
| 12 |
# WHAT IT EXPOSES (all registered BEFORE the SPA catch-all via routes.insert(0)):
|
| 13 |
+
# GET /mcp/ — MCP discovery card (canonical live MCP)
|
| 14 |
# POST /mcp/ — MCP JSON-RPC (initialize, tools/list, tools/call)
|
| 15 |
# GET /api/<ns>/v1/agent/tools — plain tool catalog (mirror of MCP tools/list)
|
|
|
|
|
|
|
| 16 |
# POST /api/<ns>/v1/agent/run — the GOVERNED AGENT RUN (the whole loop)
|
| 17 |
# POST /api/<ns>/v1/agent/verify-chain— re-verify a run's chained receipt
|
| 18 |
# GET /ask-and-act — the consumer/investor UI (one button)
|
|
|
|
| 36 |
import hashlib
|
| 37 |
import json
|
| 38 |
import math
|
|
|
|
| 39 |
import time
|
| 40 |
import uuid
|
| 41 |
from datetime import datetime, timezone
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
# ----------------------------------------------------------------------------
|
| 44 |
# FORMULA WIRING (ADDITIVE 2026-06-06): the ~80 kernel-verified theorems wired
|
| 45 |
# to REAL work. szl_formula_wiring exposes deterministic mechanisms that COMPUTE
|
|
|
|
| 747 |
from starlette.responses import JSONResponse, HTMLResponse
|
| 748 |
from starlette.requests import Request
|
| 749 |
|
| 750 |
+
# in-memory chain of FULL runs (each run is itself a chained sub-ledger).
|
| 751 |
_RUN_CHAIN = [] # list of {run_id, final_hash, prev_run_hash}
|
| 752 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 753 |
def _do_run(query: str, action: str, severity: str, confidence: float,
|
| 754 |
reversible: bool, untrusted_input: str = "", approval_grant=None,
|
| 755 |
precondition_hash=None):
|
|
|
|
| 823 |
"quarantined": True,
|
| 824 |
"feeds_decision": False})
|
| 825 |
|
| 826 |
+
# ---- HOP 3: MCP tool-call (policy_check tool, via the canonical MCP) ----
|
| 827 |
with tr.span("tool_call", "mcp") as sp:
|
| 828 |
tool_name = "policy_check"
|
| 829 |
tool_input = {"action": action, "severity": severity,
|
|
|
|
| 1023 |
sealed = _chain_receipt("emit", {"decision": decision,
|
| 1024 |
"emitted": effect["emitted"],
|
| 1025 |
"signed": bool(envelope.get("signed"))})
|
|
|
|
| 1026 |
|
| 1027 |
# ---- OPERATOR + GRAPH + UNIFYING FORMULA WIRING (real, executed on the
|
| 1028 |
# ---- SEALED chain) — these mechanisms run on the actual receipts below.
|
|
|
|
| 1088 |
"decision": decision}
|
| 1089 |
_RUN_CHAIN.append(run_record)
|
| 1090 |
|
| 1091 |
+
return {
|
| 1092 |
"run_id": tr.trace_id,
|
| 1093 |
"decision": decision,
|
| 1094 |
"emitted": effect["emitted"],
|
| 1095 |
+
"summary": _plain_summary(decision, action, effect, reasons, trust, trust_pass),
|
|
|
|
| 1096 |
"retrieved": chunks,
|
| 1097 |
"untrusted": {"present": bool(untrusted_input),
|
| 1098 |
"excerpt": (untrusted_input or "")[:240],
|
|
|
|
| 1118 |
"signed_receipt": envelope,
|
| 1119 |
"chain_final_hash": prev_hash,
|
| 1120 |
"chain_depth": len(chain),
|
| 1121 |
+
"signer": signer_label,
|
|
|
|
|
|
|
| 1122 |
"verify_hint": ("Re-verify with POST /api/%s/v1/agent/verify-chain "
|
| 1123 |
+
"(send the whole run object back). The final receipt is "
|
| 1124 |
+
"signed; fetch /cosign.pub to verify offline." % ns),
|
| 1125 |
"doctrine": "v11",
|
| 1126 |
"honesty": ("Trust score is advisory (Conjecture 1). RAG retrieves over the "
|
| 1127 |
+
"in-image governance corpus. The receipt is %s." % signer_label),
|
|
|
|
| 1128 |
}
|
| 1129 |
+
|
| 1130 |
+
def _plain_summary(decision, action, effect, reasons, trust, trust_pass):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1131 |
if decision == "ALLOW":
|
| 1132 |
return ("Allowed. After retrieving the relevant guidance, calling the policy "
|
| 1133 |
"tool, passing the safety gate and the advisory trust check (score "
|
| 1134 |
+
"%.2f), the action \"%s\" was %s. A signed receipt was produced."
|
| 1135 |
+
% (trust, action, effect["effect"]))
|
| 1136 |
why = "; ".join(reasons) if reasons else ("advisory trust score %.2f below the floor" % trust)
|
| 1137 |
return ("Blocked. The safety/trust gate denied \"%s\" because: %s. No action was "
|
| 1138 |
+
"taken — only a signed deny receipt was produced. This is the gate working."
|
| 1139 |
+
% (action, why))
|
| 1140 |
|
| 1141 |
def _verify_chain(run: dict):
|
| 1142 |
"""Re-verify a run object: (1) chain integrity (each prev_hash links and each
|
|
|
|
| 1188 |
"Flip any byte in any receipt body and chain_intact becomes false."),
|
| 1189 |
}
|
| 1190 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1191 |
# ------------------------------------------------------------------ #
|
| 1192 |
# OUROBOROS CLOSED LOOP (ADDITIVE 2026-07-03, default-OFF, honest).
|
| 1193 |
# Wraps the single governed pass `_do_run` into a BOUNDED, WITNESSED,
|
|
|
|
| 1398 |
except Exception: # pragma: no cover - SGH must never take the cycle down
|
| 1399 |
return core
|
| 1400 |
|
| 1401 |
+
# ---- MCP JSON-RPC handler (canonical live MCP) ----
|
| 1402 |
async def _mcp_post(request: Request):
|
| 1403 |
try:
|
| 1404 |
body = await request.json()
|
|
|
|
| 1496 |
return {"_error": True, "detail": "unknown tool: %s" % name}
|
| 1497 |
|
| 1498 |
async def _mcp_get(request: Request):
|
| 1499 |
+
# MCP discovery card — proves a real, live, canonical MCP surface.
|
|
|
|
| 1500 |
return JSONResponse({
|
| 1501 |
"name": "szl-%s-mcp" % ns,
|
| 1502 |
+
"title": "SZL %s — canonical governed MCP" % ns,
|
| 1503 |
"protocol": "Model Context Protocol (JSON-RPC over Streamable HTTP)",
|
| 1504 |
"protocolVersion": "2024-11-05",
|
| 1505 |
"transport": {"post": "/mcp/ (JSON-RPC: initialize, tools/list, tools/call)"},
|
| 1506 |
"tools": _tool_catalog(ns),
|
| 1507 |
"tool_count": len(_tool_catalog(ns)),
|
| 1508 |
+
"canonical": True,
|
| 1509 |
+
"note": ("This is the single canonical live MCP for %s. The previously "
|
| 1510 |
+
"advertised standalone MCP Spaces are retired; this surface replaces them." % ns),
|
|
|
|
|
|
|
| 1511 |
"doctrine": "v11",
|
| 1512 |
})
|
| 1513 |
|
|
|
|
| 1529 |
|
| 1530 |
async def _agent_tools(request: Request):
|
| 1531 |
return JSONResponse({"tools": _tool_catalog(ns), "count": len(_tool_catalog(ns)),
|
| 1532 |
+
"canonical_mcp": "/mcp/", "doctrine": "v11"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1533 |
|
| 1534 |
async def _agent_governance_standards(request: Request):
|
| 1535 |
return JSONResponse(governance_standards_note())
|
|
|
|
| 1595 |
Route("/mcp", _mcp_any, methods=["GET", "POST"], name="%s_mcp_noslash" % ns),
|
| 1596 |
Route("/api/%s/v1/agent/run" % ns, _agent_run, methods=["POST"], name="%s_agent_run" % ns),
|
| 1597 |
Route("/api/%s/v1/agent/tools" % ns, _agent_tools, methods=["GET"], name="%s_agent_tools" % ns),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1598 |
Route("/api/%s/v1/agent/governance-standards" % ns, _agent_governance_standards,
|
| 1599 |
methods=["GET"], name="%s_agent_gov_standards" % ns),
|
| 1600 |
Route("/api/%s/v1/agent/verify-chain" % ns, _agent_verify, methods=["POST"], name="%s_agent_verify" % ns),
|
|
|
|
| 1602 |
Route("/ask-and-act", _ask_and_act_ui, methods=["GET"], name="%s_ask_and_act" % ns),
|
| 1603 |
Route("/governed-run", _ask_and_act_ui, methods=["GET"], name="%s_governed_run" % ns),
|
| 1604 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1605 |
# insert at position 0 so they win over the SPA catch-all (the known gotcha).
|
| 1606 |
for r in reversed(routes):
|
| 1607 |
app.router.routes.insert(0, r)
|
szl_frontier_manifest.py
CHANGED
|
@@ -10,7 +10,7 @@ capability as a labeled tile. The manifest is REAL data pulled IN-PROCESS from t
|
|
| 10 |
already-wired surfaces — it never fabricates a status, joule, receipt, or label:
|
| 11 |
|
| 12 |
* energy operator — szl_energy_operator.handle_status() (MEASURED joules/jobs)
|
| 13 |
-
* energy ledger — szl_energy_ledger.handle_ledger() (
|
| 14 |
* energy provenance— szl_energy_provenance summary (tamper-evident chain)
|
| 15 |
* UDS bundle sig — szl_uds_fleet narrative (cosign+Rekor pattern) (label honest)
|
| 16 |
* orbital tier — szl_orbital_topology / _projection (MODELED roadmap)
|
|
@@ -34,12 +34,12 @@ DOCTRINE v11 (this surface is a roll-up — be ruthless about honesty):
|
|
| 34 |
- If a sub-source raises or is down, its tile says so honestly
|
| 35 |
(label "UNAVAILABLE", ok:false, the error) — we degrade the tile, never the truth,
|
| 36 |
and the manifest as a whole still returns 200 with the surviving tiles.
|
| 37 |
-
- The composite inference-provenance
|
| 38 |
-
|
| 39 |
-
|
| 40 |
|
| 41 |
-
The composition is the whole point: SZL already holds the parts (
|
| 42 |
-
|
| 43 |
orbital roadmap). This manifest shows them as one frontier surface, honestly labeled.
|
| 44 |
"""
|
| 45 |
from __future__ import annotations
|
|
@@ -57,7 +57,7 @@ UNAVAILABLE = "UNAVAILABLE"
|
|
| 57 |
_API = "/api/a11oy/v1"
|
| 58 |
|
| 59 |
# UNIVERSAL Khipu verifier (judge-facing audit layer, szl_khipu_verify). A reader
|
| 60 |
-
# pastes ANY receipt digest from ANY organ and gets
|
| 61 |
# PASS|FAIL|NOT_FOUND (SHA3-256 seal recompute + prev-link re-walk to genesis).
|
| 62 |
# This is the REAL endpoint each verifiable tile's `verify` field points to. Only
|
| 63 |
# tiles whose receipts genuinely live in a shared szl_khipu organ DAG (immune,
|
|
@@ -105,115 +105,6 @@ def _unavailable_tile(name: str, category: str, provenance: dict, err: str) -> d
|
|
| 105 |
error=err)
|
| 106 |
|
| 107 |
|
| 108 |
-
def _tile_operational_readiness(tile: dict) -> tuple[bool, list[str]]:
|
| 109 |
-
"""Derive runtime readiness from tile evidence without upgrading its label.
|
| 110 |
-
|
| 111 |
-
A source can answer while its operator is stopped, its chain is empty, its
|
| 112 |
-
hardware is unreachable, or its required artifact has not been minted.
|
| 113 |
-
Reachability is therefore reported separately from operational readiness.
|
| 114 |
-
"""
|
| 115 |
-
reasons: list[str] = []
|
| 116 |
-
label = str(tile.get("label") or UNAVAILABLE).upper()
|
| 117 |
-
status = str(tile.get("status") or "").upper()
|
| 118 |
-
evidence = tile.get("operational_evidence")
|
| 119 |
-
|
| 120 |
-
# Absence of a negative is not positive evidence. Every ready tile must name
|
| 121 |
-
# its exact bounded predicate and report that predicate satisfied.
|
| 122 |
-
if not isinstance(evidence, dict):
|
| 123 |
-
reasons.append("explicit_operational_evidence_missing")
|
| 124 |
-
else:
|
| 125 |
-
predicate = evidence.get("predicate")
|
| 126 |
-
if not isinstance(predicate, str) or not predicate.strip():
|
| 127 |
-
reasons.append("explicit_operational_predicate_missing")
|
| 128 |
-
if evidence.get("satisfied") is not True:
|
| 129 |
-
evidence_reasons = evidence.get("reasons")
|
| 130 |
-
if isinstance(evidence_reasons, list) and evidence_reasons:
|
| 131 |
-
reasons.extend(str(reason) for reason in evidence_reasons)
|
| 132 |
-
else:
|
| 133 |
-
reasons.append("explicit_operational_evidence_not_satisfied")
|
| 134 |
-
|
| 135 |
-
if not tile.get("ok", True):
|
| 136 |
-
reasons.append("source_unavailable")
|
| 137 |
-
if label in {UNAVAILABLE, MODELED, ROADMAP, SAMPLE}:
|
| 138 |
-
reasons.append(f"label_{label.lower()}_is_not_operational_evidence")
|
| 139 |
-
if any(token in status for token in ("UNAVAILABLE", "IDLE", "EMPTY", "STOPPED")):
|
| 140 |
-
reasons.append("status_not_running")
|
| 141 |
-
if tile.get("running") is False:
|
| 142 |
-
reasons.append("operator_stopped")
|
| 143 |
-
if tile.get("on_artifact_minted") is False:
|
| 144 |
-
reasons.append("artifact_not_minted")
|
| 145 |
-
if tile.get("on_orbit_hardware") is False:
|
| 146 |
-
reasons.append("hardware_not_present")
|
| 147 |
-
if "nodes_reachable" in tile and int(tile.get("nodes_reachable") or 0) < 1:
|
| 148 |
-
reasons.append("no_nodes_reachable")
|
| 149 |
-
if "reachable_nodes" in tile and int(tile.get("reachable_nodes") or 0) < 1:
|
| 150 |
-
reasons.append("no_nodes_reachable")
|
| 151 |
-
if "chain_length" in tile and int(tile.get("chain_length") or 0) < 1:
|
| 152 |
-
reasons.append("no_chain_entries")
|
| 153 |
-
if "length" in tile and int(tile.get("length") or 0) < 1:
|
| 154 |
-
reasons.append("no_chain_entries")
|
| 155 |
-
if "links_intact" in tile and tile.get("links_intact") is not True:
|
| 156 |
-
reasons.append("chain_links_not_verified")
|
| 157 |
-
if "chain_ok" in tile and tile.get("chain_ok") is not True:
|
| 158 |
-
reasons.append("chain_not_verified")
|
| 159 |
-
if "survives_redeploy" in tile and tile.get("survives_redeploy") is not True:
|
| 160 |
-
reasons.append("persistence_not_verified")
|
| 161 |
-
if tile.get("signature_required") is True and tile.get("signature_verified") is not True:
|
| 162 |
-
reasons.append("cryptographic_signature_not_verified")
|
| 163 |
-
|
| 164 |
-
unique_reasons = list(dict.fromkeys(reasons))
|
| 165 |
-
return not unique_reasons, unique_reasons
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
def _runtime_signature_readiness(info: dict) -> tuple[bool, list[str], dict]:
|
| 169 |
-
"""Require an observed runtime signer and a cryptographically verified receipt.
|
| 170 |
-
|
| 171 |
-
Static policy metadata such as ``signed_receipts=true`` describes an intended
|
| 172 |
-
contract. It is neither signer health nor proof that a signature was produced
|
| 173 |
-
and verified, so it cannot make the governance tile operational.
|
| 174 |
-
"""
|
| 175 |
-
signer = info.get("signer_health") if isinstance(info.get("signer_health"), dict) else {}
|
| 176 |
-
verification = (info.get("receipt_verification")
|
| 177 |
-
if isinstance(info.get("receipt_verification"), dict) else {})
|
| 178 |
-
method = str(verification.get("method") or "").strip()
|
| 179 |
-
method_upper = method.upper()
|
| 180 |
-
signature_count = verification.get("signature_count")
|
| 181 |
-
try:
|
| 182 |
-
signature_count = int(signature_count)
|
| 183 |
-
except (TypeError, ValueError):
|
| 184 |
-
signature_count = 0
|
| 185 |
-
|
| 186 |
-
reasons = []
|
| 187 |
-
if signer.get("observed_this_process") is not True:
|
| 188 |
-
reasons.append("signer_health_not_observed")
|
| 189 |
-
if signer.get("ready") is not True:
|
| 190 |
-
reasons.append("signer_not_ready")
|
| 191 |
-
if verification.get("observed_this_process") is not True:
|
| 192 |
-
reasons.append("receipt_verification_not_observed")
|
| 193 |
-
if verification.get("cryptographically_verified") is not True:
|
| 194 |
-
reasons.append("cryptographic_signature_not_verified")
|
| 195 |
-
if signature_count < 1:
|
| 196 |
-
reasons.append("verified_signature_missing")
|
| 197 |
-
if not method or "PLACEHOLDER" in method_upper or method_upper in {"HASH", "HASH_CHAIN"}:
|
| 198 |
-
reasons.append("cryptographic_verification_method_missing")
|
| 199 |
-
|
| 200 |
-
evidence = {
|
| 201 |
-
"signer_observed_this_process": signer.get("observed_this_process") is True,
|
| 202 |
-
"signer_ready": signer.get("ready") is True,
|
| 203 |
-
"signer_identity": signer.get("identity"),
|
| 204 |
-
"receipt_verification_observed_this_process": (
|
| 205 |
-
verification.get("observed_this_process") is True
|
| 206 |
-
),
|
| 207 |
-
"cryptographically_verified": (
|
| 208 |
-
verification.get("cryptographically_verified") is True
|
| 209 |
-
),
|
| 210 |
-
"signature_count": signature_count,
|
| 211 |
-
"verification_method": method or None,
|
| 212 |
-
}
|
| 213 |
-
unique_reasons = list(dict.fromkeys(reasons))
|
| 214 |
-
return not unique_reasons, unique_reasons, evidence
|
| 215 |
-
|
| 216 |
-
|
| 217 |
# ---------------------------------------------------------------------------
|
| 218 |
# Per-capability tile builders. Each pulls IN-PROCESS from the live surface.
|
| 219 |
# ---------------------------------------------------------------------------
|
|
@@ -243,11 +134,6 @@ def _tile_energy_operator() -> dict:
|
|
| 243 |
joules_measured_total=measured_total,
|
| 244 |
measured_jobs=measured_jobs,
|
| 245 |
jobs_done=st.get("jobs_done"),
|
| 246 |
-
operational_evidence={
|
| 247 |
-
"predicate": "energy operator reports running=true",
|
| 248 |
-
"satisfied": running,
|
| 249 |
-
"reasons": [] if running else ["operator_stopped"],
|
| 250 |
-
},
|
| 251 |
)
|
| 252 |
|
| 253 |
|
|
@@ -265,16 +151,14 @@ def _tile_energy_ledger() -> dict:
|
|
| 265 |
if isinstance(head, dict):
|
| 266 |
head_digest = head.get("entry_digest") or head.get("digest") \
|
| 267 |
or (head.get("receipt") or {}).get("payload_digest")
|
| 268 |
-
status = (f"OK ({chain_len}
|
| 269 |
if chain_len else "IDLE (chain empty — no jobs minted yet)")
|
| 270 |
return _tile(
|
| 271 |
-
"
|
| 272 |
provenance={
|
| 273 |
"endpoint": f"{_API}/energy/ledger",
|
| 274 |
-
"kind":
|
| 275 |
-
"no cryptographic signature is verified by this surface"),
|
| 276 |
"chain_head_digest": head_digest,
|
| 277 |
-
"signature_status": "NOT_VERIFIED_INTEGRITY_ONLY",
|
| 278 |
"single_receipt": f"{_API}/energy/receipt/{{idempotency_key}}",
|
| 279 |
# The energy ledger is its OWN hash-chained JouleCharge chain (not a shared
|
| 280 |
# szl_khipu organ DAG), so its honest verify surface is the ledger endpoint
|
|
@@ -288,17 +172,6 @@ def _tile_energy_ledger() -> dict:
|
|
| 288 |
persistence_label=persistence.get("label"),
|
| 289 |
survives_redeploy=survives,
|
| 290 |
persistence_note=persistence.get("note"),
|
| 291 |
-
operational_evidence={
|
| 292 |
-
"predicate": "non-empty ledger + intact links + verified redeploy persistence",
|
| 293 |
-
"satisfied": bool(chain_len and links_intact is True and survives),
|
| 294 |
-
"reasons": [
|
| 295 |
-
reason for failed, reason in (
|
| 296 |
-
(not chain_len, "no_chain_entries"),
|
| 297 |
-
(links_intact is not True, "chain_links_not_verified"),
|
| 298 |
-
(not survives, "persistence_not_verified"),
|
| 299 |
-
) if failed
|
| 300 |
-
],
|
| 301 |
-
},
|
| 302 |
)
|
| 303 |
|
| 304 |
|
|
@@ -306,8 +179,7 @@ def _tile_energy_provenance() -> dict:
|
|
| 306 |
import szl_energy_provenance as ep
|
| 307 |
summ = ep._CHAIN.summary()
|
| 308 |
length = summ.get("length", 0)
|
| 309 |
-
|
| 310 |
-
status = (f"INTEGRITY-VERIFIED ({length} tamper-evident receipts)" if length
|
| 311 |
else "EMPTY (no receipts this process)")
|
| 312 |
return _tile(
|
| 313 |
"Energy provenance chain", "provenance", status=status, label=MEASURED,
|
|
@@ -316,24 +188,12 @@ def _tile_energy_provenance() -> dict:
|
|
| 316 |
"kind": "tamper-evident hash-linked + Bekenstein-gated chain",
|
| 317 |
"head_hash": summ.get("head_hash"),
|
| 318 |
"link_rule": summ.get("link_rule"),
|
| 319 |
-
"signature_status": "NOT_VERIFIED_INTEGRITY_ONLY",
|
| 320 |
# Its OWN Bekenstein-gated chain (not a shared szl_khipu organ) -> honest
|
| 321 |
# verify surface is its own endpoint, re-walked. Not pointed at /khipu/verify.
|
| 322 |
"verify": f"{_API}/energy/provenance",
|
| 323 |
},
|
| 324 |
length=length,
|
| 325 |
-
|
| 326 |
-
verification_scope="content and hash-link integrity only; authorship not verified",
|
| 327 |
-
operational_evidence={
|
| 328 |
-
"predicate": "non-empty provenance chain + computed chain verification",
|
| 329 |
-
"satisfied": bool(length and verify.get("ok") is True),
|
| 330 |
-
"reasons": [
|
| 331 |
-
reason for failed, reason in (
|
| 332 |
-
(not length, "no_chain_entries"),
|
| 333 |
-
(verify.get("ok") is not True, "chain_not_verified"),
|
| 334 |
-
) if failed
|
| 335 |
-
],
|
| 336 |
-
},
|
| 337 |
)
|
| 338 |
|
| 339 |
|
|
@@ -359,11 +219,6 @@ def _tile_uds_bundle() -> dict:
|
|
| 359 |
"sbom": "CycloneDX / SPDX in-toto attestation",
|
| 360 |
"backing_module": backing,
|
| 361 |
},
|
| 362 |
-
operational_evidence={
|
| 363 |
-
"predicate": "a concrete UDS attestation is independently verified at runtime",
|
| 364 |
-
"satisfied": False,
|
| 365 |
-
"reasons": ["runtime_attestation_receipt_not_observed"],
|
| 366 |
-
},
|
| 367 |
)
|
| 368 |
|
| 369 |
|
|
@@ -388,11 +243,6 @@ def _tile_orbital() -> dict:
|
|
| 388 |
# reachable_nodes is REAL-PROBE-ONLY and MUST be 0 — no orbital hardware to probe.
|
| 389 |
reachable_nodes=reachable,
|
| 390 |
note="every orbital node is modeled:true / reachable:false; a MODELED orbital joule is NEVER MEASURED",
|
| 391 |
-
operational_evidence={
|
| 392 |
-
"predicate": "at least one on-orbit hardware node is positively reachable",
|
| 393 |
-
"satisfied": False,
|
| 394 |
-
"reasons": ["hardware_not_present"],
|
| 395 |
-
},
|
| 396 |
)
|
| 397 |
|
| 398 |
|
|
@@ -421,11 +271,6 @@ def _tile_compute_fabric() -> dict:
|
|
| 421 |
# reachable / gpu_reachable are REAL-PROBE-ONLY facts.
|
| 422 |
nodes_reachable=reachable_n,
|
| 423 |
gpu_reachable=gpu_reachable,
|
| 424 |
-
operational_evidence={
|
| 425 |
-
"predicate": "at least one sovereign GPU node passes the live reachability probe",
|
| 426 |
-
"satisfied": gpu_reachable > 0,
|
| 427 |
-
"reasons": [] if gpu_reachable > 0 else ["no_sovereign_gpu_reachable"],
|
| 428 |
-
},
|
| 429 |
)
|
| 430 |
|
| 431 |
|
|
@@ -436,50 +281,35 @@ def _tile_governance() -> dict:
|
|
| 436 |
import szl_restraint as rs
|
| 437 |
info = rs.info()
|
| 438 |
doctrine = info.get("doctrine", {}) or {}
|
| 439 |
-
crypto_ready, crypto_reasons, crypto_evidence = _runtime_signature_readiness(info)
|
| 440 |
-
status = ("OK (runtime signer healthy; receipt signature cryptographically verified)"
|
| 441 |
-
if crypto_ready else
|
| 442 |
-
"DEGRADED (doctrine loaded; runtime signer/receipt verification not observed)")
|
| 443 |
return _tile(
|
| 444 |
-
"Governance / restraint", "governance", status=
|
| 445 |
label=MEASURED,
|
| 446 |
provenance={
|
| 447 |
"endpoint": f"{_API}/restraint/info",
|
| 448 |
-
"kind":
|
| 449 |
-
"requires observed signer health and cryptographic receipt verification"),
|
| 450 |
"doctrine_version": doctrine.get("version"),
|
| 451 |
"kernel_commit": doctrine.get("kernel_commit"),
|
| 452 |
},
|
| 453 |
-
|
| 454 |
-
signer_health=crypto_evidence,
|
| 455 |
-
signature_required=True,
|
| 456 |
-
signature_verified=crypto_ready,
|
| 457 |
runtime_cdn=doctrine.get("runtime_cdn"),
|
| 458 |
lambda_=doctrine.get("lambda"),
|
| 459 |
-
operational_evidence={
|
| 460 |
-
"predicate": ("runtime signer health observed + at least one receipt signature "
|
| 461 |
-
"cryptographically verified this process"),
|
| 462 |
-
"satisfied": crypto_ready,
|
| 463 |
-
"reasons": crypto_reasons,
|
| 464 |
-
},
|
| 465 |
)
|
| 466 |
|
| 467 |
|
| 468 |
def _concept_tile_inference_provenance() -> dict:
|
| 469 |
"""#1 frontier play — composite inference-provenance receipt (the inference-side C2PA).
|
| 470 |
|
| 471 |
-
|
| 472 |
-
NEVER mints a receipt. The capstone surface szl_provenance_receipt composes ONE
|
| 473 |
-
|
| 474 |
PAC-Bayes bound + MEASURED/MODELED/SAMPLE energy label + governed model identity + Lean
|
| 475 |
-
backing)
|
| 476 |
-
|
| 477 |
-
creates evidence. Here we READ the
|
| 478 |
chain head (depth + most-recent composite digest, if any) and re-verify chain
|
| 479 |
integrity, so the tile honestly DESCRIBES the capability and points to where the real
|
| 480 |
artifacts live (/provenance/receipt + the energy ledger) without growing the chain.
|
| 481 |
Honesty held: a GET does not fabricate or mint a composite; if no composite exists yet
|
| 482 |
-
the tile
|
| 483 |
import szl_khipu
|
| 484 |
import szl_provenance_receipt as pr
|
| 485 |
|
|
@@ -490,61 +320,30 @@ def _concept_tile_inference_provenance() -> dict:
|
|
| 490 |
head = dag.head()
|
| 491 |
# Most-recent composite digest already on the chain (a READ, never a mint).
|
| 492 |
last_composite = None
|
| 493 |
-
last_composite_receipt = None
|
| 494 |
for r in reversed(dag.tail(depth or 1)):
|
| 495 |
if r.get("action") == "provenance.composite":
|
| 496 |
last_composite = r.get("digest")
|
| 497 |
-
last_composite_receipt = r
|
| 498 |
break
|
| 499 |
|
| 500 |
minted = last_composite is not None
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
"cryptographic_verification"), dict) else {})
|
| 506 |
-
verification_method = str(verification.get("method") or "").strip()
|
| 507 |
-
try:
|
| 508 |
-
verified_signature_count = int(verification.get("signature_count") or 0)
|
| 509 |
-
except (TypeError, ValueError):
|
| 510 |
-
verified_signature_count = 0
|
| 511 |
-
signature_verified = bool(
|
| 512 |
-
minted
|
| 513 |
-
and verification.get("observed_this_process") is True
|
| 514 |
-
and verification.get("verified") is True
|
| 515 |
-
and verified_signature_count > 0
|
| 516 |
-
and verification_method
|
| 517 |
-
and "PLACEHOLDER" not in verification_method.upper()
|
| 518 |
-
and signature not in (None, "", "DSSE_PLACEHOLDER")
|
| 519 |
-
)
|
| 520 |
-
if minted and signature_verified:
|
| 521 |
-
status = (f"LIVE ({depth} receipts on the provenance chain; latest composite has an "
|
| 522 |
-
"observed, cryptographically verified signature and binds immune verdict + "
|
| 523 |
-
"PAC-Bayes bound + energy label + governed model identity + Lean backing).")
|
| 524 |
label = MEASURED
|
| 525 |
-
note = ("inference-side
|
| 526 |
-
"
|
| 527 |
-
"the PAC-Bayes bound (ROADMAP Lean), the "
|
| 528 |
"MEASURED/MODELED/SAMPLE energy label, the governed model identity, and the "
|
| 529 |
-
"exact Lean backing. Each part KEEPS its own label; no label is upgraded
|
| 530 |
-
"This tile READS the chain — it does "
|
| 531 |
"NOT mint a receipt per page view. POST the endpoint to mint one for a real "
|
| 532 |
"action, then GET it back by digest.")
|
| 533 |
-
elif minted:
|
| 534 |
-
status = (f"INTEGRITY-ONLY ({depth} hash-chained receipts; latest composite exists, "
|
| 535 |
-
"but no cryptographically verified DSSE signature was observed)")
|
| 536 |
-
label = UNAVAILABLE
|
| 537 |
-
note = ("the composite is content-addressed and its Khipu prev-links re-walk, but "
|
| 538 |
-
"DSSE_PLACEHOLDER is not a signature and proves no authorship. The signed "
|
| 539 |
-
"composite capability remains operationally blocked until real DSSE evidence "
|
| 540 |
-
"is verified this process.")
|
| 541 |
else:
|
| 542 |
-
status = ("
|
| 543 |
-
"
|
| 544 |
-
label =
|
| 545 |
-
note = ("inference-side C2PA capability is
|
| 546 |
-
"
|
| 547 |
-
"this process yet. A composite is created ONLY on a real POST to "
|
| 548 |
"/provenance/receipt (immune verdict + PAC-Bayes bound + energy label + "
|
| 549 |
"governed model identity + Lean backing) — never fabricated, never minted by "
|
| 550 |
"loading this manifest.")
|
|
@@ -553,9 +352,10 @@ def _concept_tile_inference_provenance() -> dict:
|
|
| 553 |
"Composite inference-provenance receipt", "frontier-concept",
|
| 554 |
status=status, label=label,
|
| 555 |
provenance={
|
| 556 |
-
"kind":
|
| 557 |
-
|
| 558 |
-
|
|
|
|
| 559 |
"endpoint": f"{_API}/provenance/receipt",
|
| 560 |
# Composite receipts live in the shared szl_khipu `provenance` organ, so a
|
| 561 |
# judge can re-verify a composite digest TWO honest ways: the composite
|
|
@@ -568,36 +368,16 @@ def _concept_tile_inference_provenance() -> dict:
|
|
| 568 |
"latest_composite_digest": last_composite,
|
| 569 |
"chain_head": head,
|
| 570 |
"chain_verified": chain.get("ok"),
|
| 571 |
-
"signature_status": ("CRYPTOGRAPHICALLY_VERIFIED" if signature_verified else
|
| 572 |
-
"NOT_VERIFIED_INTEGRITY_ONLY"),
|
| 573 |
-
"signature_verification_method": verification_method or None,
|
| 574 |
"composes_measured": f"{_API}/immune/verdict (REAL fail-closed gate) + the "
|
| 575 |
"MEASURED energy joule-truth path",
|
| 576 |
-
"
|
| 577 |
-
"retain the status reported by that dependency)",
|
| 578 |
},
|
| 579 |
# READ facts straight off the chain — this tile mints nothing on a GET.
|
| 580 |
on_artifact_minted=minted,
|
| 581 |
composite_digest=last_composite,
|
| 582 |
chain_ok=chain.get("ok"),
|
| 583 |
chain_length=depth,
|
| 584 |
-
signature_required=True,
|
| 585 |
-
signature_verified=signature_verified,
|
| 586 |
note=note,
|
| 587 |
-
operational_evidence={
|
| 588 |
-
"predicate": ("a composite exists, its Khipu integrity chain verifies, and its "
|
| 589 |
-
"DSSE signature is cryptographically verified this process"),
|
| 590 |
-
"satisfied": bool(minted and depth > 0 and chain.get("ok") is True
|
| 591 |
-
and signature_verified),
|
| 592 |
-
"reasons": [
|
| 593 |
-
reason for failed, reason in (
|
| 594 |
-
(not minted, "artifact_not_minted"),
|
| 595 |
-
(depth < 1, "no_chain_entries"),
|
| 596 |
-
(chain.get("ok") is not True, "chain_not_verified"),
|
| 597 |
-
(not signature_verified, "cryptographic_signature_not_verified"),
|
| 598 |
-
) if failed
|
| 599 |
-
],
|
| 600 |
-
},
|
| 601 |
)
|
| 602 |
|
| 603 |
|
|
@@ -606,7 +386,7 @@ def _concept_tile_inference_provenance() -> dict:
|
|
| 606 |
_TILE_SPECS: list[tuple[Callable[[], dict], str, str, dict]] = [
|
| 607 |
(_tile_energy_operator, "Energy operator", "energy",
|
| 608 |
{"endpoint": f"{_API}/energy/operator/status"}),
|
| 609 |
-
(_tile_energy_ledger, "
|
| 610 |
{"endpoint": f"{_API}/energy/ledger"}),
|
| 611 |
(_tile_energy_provenance, "Energy provenance chain", "provenance",
|
| 612 |
{"endpoint": f"{_API}/energy/provenance"}),
|
|
@@ -650,8 +430,7 @@ def _build_manifest() -> dict:
|
|
| 650 |
tiles.append(tile if tile is not None
|
| 651 |
else _unavailable_tile(name, category, prov, err or "unknown error"))
|
| 652 |
|
| 653 |
-
#
|
| 654 |
-
# minted an artifact. A manifest read never creates operational evidence.
|
| 655 |
concept, c_err = _safe(_concept_tile_inference_provenance)
|
| 656 |
if concept is None: # pragma: no cover — the concept tile is pure data
|
| 657 |
concept = _unavailable_tile("Composite inference-provenance receipt",
|
|
@@ -662,79 +441,47 @@ def _build_manifest() -> dict:
|
|
| 662 |
for t in tiles:
|
| 663 |
label_counts[t["label"]] = label_counts.get(t["label"], 0) + 1
|
| 664 |
degraded = [t["name"] for t in tiles if not t.get("ok", True)]
|
| 665 |
-
reachable = [t["name"] for t in tiles if t.get("ok", True)]
|
| 666 |
-
readiness_rows = []
|
| 667 |
-
for tile in tiles:
|
| 668 |
-
ready, reasons = _tile_operational_readiness(tile)
|
| 669 |
-
readiness_rows.append({"name": tile["name"], "ready": ready, "reasons": reasons})
|
| 670 |
-
blocked = [row for row in readiness_rows if not row["ready"]]
|
| 671 |
-
all_sources_reachable = len(degraded) == 0
|
| 672 |
-
operationally_ready = not blocked and bool(tiles)
|
| 673 |
|
| 674 |
return {
|
| 675 |
"ok": True,
|
| 676 |
"endpoint": "frontier/manifest",
|
| 677 |
"service": "a11oy.frontier.manifest",
|
| 678 |
"what": ("one honest roll-up of the SZL governed-provenance ecosystem — every "
|
| 679 |
-
"capability as a tile with its
|
| 680 |
"a provenance pointer. Composed live, in-process, from the wired surfaces."),
|
| 681 |
"doctrine": (
|
| 682 |
"v11: REAL composed data only. No label is upgraded (orbital stays MODELED, "
|
| 683 |
"ROADMAP stays ROADMAP). reachable/running/survives_redeploy are REAL-PROBE-ONLY "
|
| 684 |
"and read straight from the live surfaces. A down sub-source yields an honest "
|
| 685 |
-
"UNAVAILABLE tile, never a fabricated OK. The composite receipt
|
| 686 |
-
"
|
| 687 |
"Λ = Conjecture 1."
|
| 688 |
),
|
| 689 |
"universal_verifier": {
|
| 690 |
-
"what": "judge-facing
|
| 691 |
"szl_khipu organ (immune, materials, kverify, provenance, sda, "
|
| 692 |
-
"nemo_agents) and get
|
| 693 |
"verify_post": _KHIPU_VERIFY,
|
| 694 |
"verify_link": _KHIPU_VERIFY_PATH,
|
| 695 |
"organs": _KHIPU_ORGANS,
|
| 696 |
-
"method": "
|
| 697 |
-
"
|
| 698 |
-
"
|
| 699 |
-
"signature_status":
|
| 700 |
-
|
| 701 |
-
"khipu_kind": ("tamper-evident integrity chain only; authorship remains blocked "
|
| 702 |
-
"until a real DSSE signature is verified; BFT/consensus is "
|
| 703 |
-
"Conjecture 2"),
|
| 704 |
},
|
| 705 |
"labels_legend": {
|
| 706 |
-
"MEASURED":
|
| 707 |
-
"receipts, REAL probes); MEASURED never implies signed"),
|
| 708 |
"MODELED": "design artifact derived from a real measurement (e.g. orbital joules from ground coeff)",
|
| 709 |
"ROADMAP": "named forward work; no fabricated artifact",
|
| 710 |
"SAMPLE": "illustrative sample value, never billable/live",
|
| 711 |
-
"UNAVAILABLE": "source
|
| 712 |
},
|
| 713 |
"summary": {
|
| 714 |
"tiles": len(tiles),
|
| 715 |
"label_counts": label_counts,
|
| 716 |
"degraded_tiles": degraded,
|
| 717 |
-
"
|
| 718 |
-
"state": "REACHABLE" if all_sources_reachable else "DEGRADED",
|
| 719 |
-
"all_sources_reachable": all_sources_reachable,
|
| 720 |
-
"reachable_tiles": reachable,
|
| 721 |
-
"unavailable_tiles": degraded,
|
| 722 |
-
},
|
| 723 |
-
"operational_readiness": {
|
| 724 |
-
"state": "READY" if operationally_ready else "NOT_READY",
|
| 725 |
-
"ready": operationally_ready,
|
| 726 |
-
"ready_tiles": [row["name"] for row in readiness_rows if row["ready"]],
|
| 727 |
-
"blocked_tiles": blocked,
|
| 728 |
-
},
|
| 729 |
-
# Deprecated for old clients. This value is intentionally stricter than source
|
| 730 |
-
# reachability and cannot be true while a required tile is stopped, unminted,
|
| 731 |
-
# modeled, sampled, or unavailable.
|
| 732 |
-
"all_sources_live": operationally_ready,
|
| 733 |
-
"all_sources_live_compatibility": {
|
| 734 |
-
"deprecated": True,
|
| 735 |
-
"meaning": "legacy alias for operational_readiness.ready; not source reachability",
|
| 736 |
-
"value": operationally_ready,
|
| 737 |
-
},
|
| 738 |
},
|
| 739 |
"capabilities": tiles,
|
| 740 |
"timestamp_utc": _now_iso(),
|
|
@@ -827,7 +574,7 @@ if __name__ == "__main__":
|
|
| 827 |
|
| 828 |
# 4) the #1 frontier composite tile READS the provenance chain; it NEVER mints a
|
| 829 |
# receipt on a manifest GET. A fresh process has an empty provenance chain, so the
|
| 830 |
-
# tile is honestly
|
| 831 |
import szl_khipu as _kh
|
| 832 |
import szl_provenance_receipt as _pr
|
| 833 |
_prov = _kh.get_dag(_pr._KHIPU_ORGAN, ns="a11oy")
|
|
@@ -837,11 +584,10 @@ if __name__ == "__main__":
|
|
| 837 |
assert _after == _before, (
|
| 838 |
f"manifest GET must NOT mint a provenance receipt (chain grew {_before}->{_after})")
|
| 839 |
concept = next(t for t in tiles if t["category"] == "frontier-concept")
|
| 840 |
-
assert concept["label"] in (
|
| 841 |
-
# On a fresh process (empty chain) the tile is honestly
|
| 842 |
if _before == 0:
|
| 843 |
-
assert concept["label"] ==
|
| 844 |
-
"empty chain -> honest UNAVAILABLE, no fabricated artifact"
|
| 845 |
assert concept.get("on_artifact_minted") is False, "no composite minted by a GET"
|
| 846 |
assert concept.get("composite_digest") is None, "no digest fabricated on a GET"
|
| 847 |
assert concept["provenance"].get("chain_verified") is True, "provenance chain must verify"
|
|
@@ -850,8 +596,6 @@ if __name__ == "__main__":
|
|
| 850 |
|
| 851 |
# 5) labels legend + summary present; degraded tiles (if any) reported honestly
|
| 852 |
assert "labels_legend" in m and "summary" in m
|
| 853 |
-
assert "source_reachability" in m["summary"]
|
| 854 |
-
assert "operational_readiness" in m["summary"]
|
| 855 |
print(f"[5] summary: {_json.dumps(m['summary'])}")
|
| 856 |
|
| 857 |
print("\n--- tiles (name / label / status) ---")
|
|
@@ -859,3 +603,5 @@ if __name__ == "__main__":
|
|
| 859 |
print(f" - {t['name']:38s} {t['label']:11s} {t['status']}")
|
| 860 |
print("\nok:true checks:5")
|
| 861 |
_sys.exit(0)
|
|
|
|
|
|
|
|
|
| 10 |
already-wired surfaces — it never fabricates a status, joule, receipt, or label:
|
| 11 |
|
| 12 |
* energy operator — szl_energy_operator.handle_status() (MEASURED joules/jobs)
|
| 13 |
+
* energy ledger — szl_energy_ledger.handle_ledger() (signed receipt chain)
|
| 14 |
* energy provenance— szl_energy_provenance summary (tamper-evident chain)
|
| 15 |
* UDS bundle sig — szl_uds_fleet narrative (cosign+Rekor pattern) (label honest)
|
| 16 |
* orbital tier — szl_orbital_topology / _projection (MODELED roadmap)
|
|
|
|
| 34 |
- If a sub-source raises or is down, its tile says so honestly
|
| 35 |
(label "UNAVAILABLE", ok:false, the error) — we degrade the tile, never the truth,
|
| 36 |
and the manifest as a whole still returns 200 with the surviving tiles.
|
| 37 |
+
- The #1 frontier play (composite inference-provenance receipt) is surfaced ONLY as
|
| 38 |
+
a clearly-labeled ROADMAP concept tile that NAMES its existing parts (the MEASURED
|
| 39 |
+
joule receipt + the MODELED model-hash) — no fabricated composite artifact is minted.
|
| 40 |
|
| 41 |
+
The composition is the whole point: SZL already holds the parts (signed energy
|
| 42 |
+
receipts MEASURED, signed UDS bundle MEASURED, governance doctrine MEASURED, MODELED
|
| 43 |
orbital roadmap). This manifest shows them as one frontier surface, honestly labeled.
|
| 44 |
"""
|
| 45 |
from __future__ import annotations
|
|
|
|
| 57 |
_API = "/api/a11oy/v1"
|
| 58 |
|
| 59 |
# UNIVERSAL Khipu verifier (judge-facing audit layer, szl_khipu_verify). A reader
|
| 60 |
+
# pastes ANY receipt digest from ANY organ and gets an INDEPENDENT, COMPUTED
|
| 61 |
# PASS|FAIL|NOT_FOUND (SHA3-256 seal recompute + prev-link re-walk to genesis).
|
| 62 |
# This is the REAL endpoint each verifiable tile's `verify` field points to. Only
|
| 63 |
# tiles whose receipts genuinely live in a shared szl_khipu organ DAG (immune,
|
|
|
|
| 105 |
error=err)
|
| 106 |
|
| 107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
# ---------------------------------------------------------------------------
|
| 109 |
# Per-capability tile builders. Each pulls IN-PROCESS from the live surface.
|
| 110 |
# ---------------------------------------------------------------------------
|
|
|
|
| 134 |
joules_measured_total=measured_total,
|
| 135 |
measured_jobs=measured_jobs,
|
| 136 |
jobs_done=st.get("jobs_done"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
)
|
| 138 |
|
| 139 |
|
|
|
|
| 151 |
if isinstance(head, dict):
|
| 152 |
head_digest = head.get("entry_digest") or head.get("digest") \
|
| 153 |
or (head.get("receipt") or {}).get("payload_digest")
|
| 154 |
+
status = (f"OK ({chain_len} signed receipts, links_intact={links_intact})"
|
| 155 |
if chain_len else "IDLE (chain empty — no jobs minted yet)")
|
| 156 |
return _tile(
|
| 157 |
+
"Signed energy ledger", "energy", status=status, label=MEASURED,
|
| 158 |
provenance={
|
| 159 |
"endpoint": f"{_API}/energy/ledger",
|
| 160 |
+
"kind": "hash-chained JouleCharge receipt chain",
|
|
|
|
| 161 |
"chain_head_digest": head_digest,
|
|
|
|
| 162 |
"single_receipt": f"{_API}/energy/receipt/{{idempotency_key}}",
|
| 163 |
# The energy ledger is its OWN hash-chained JouleCharge chain (not a shared
|
| 164 |
# szl_khipu organ DAG), so its honest verify surface is the ledger endpoint
|
|
|
|
| 172 |
persistence_label=persistence.get("label"),
|
| 173 |
survives_redeploy=survives,
|
| 174 |
persistence_note=persistence.get("note"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
)
|
| 176 |
|
| 177 |
|
|
|
|
| 179 |
import szl_energy_provenance as ep
|
| 180 |
summ = ep._CHAIN.summary()
|
| 181 |
length = summ.get("length", 0)
|
| 182 |
+
status = (f"VERIFIED ({length} tamper-evident receipts)" if length
|
|
|
|
| 183 |
else "EMPTY (no receipts this process)")
|
| 184 |
return _tile(
|
| 185 |
"Energy provenance chain", "provenance", status=status, label=MEASURED,
|
|
|
|
| 188 |
"kind": "tamper-evident hash-linked + Bekenstein-gated chain",
|
| 189 |
"head_hash": summ.get("head_hash"),
|
| 190 |
"link_rule": summ.get("link_rule"),
|
|
|
|
| 191 |
# Its OWN Bekenstein-gated chain (not a shared szl_khipu organ) -> honest
|
| 192 |
# verify surface is its own endpoint, re-walked. Not pointed at /khipu/verify.
|
| 193 |
"verify": f"{_API}/energy/provenance",
|
| 194 |
},
|
| 195 |
length=length,
|
| 196 |
+
chain_status=summ.get("status"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
)
|
| 198 |
|
| 199 |
|
|
|
|
| 219 |
"sbom": "CycloneDX / SPDX in-toto attestation",
|
| 220 |
"backing_module": backing,
|
| 221 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
)
|
| 223 |
|
| 224 |
|
|
|
|
| 243 |
# reachable_nodes is REAL-PROBE-ONLY and MUST be 0 — no orbital hardware to probe.
|
| 244 |
reachable_nodes=reachable,
|
| 245 |
note="every orbital node is modeled:true / reachable:false; a MODELED orbital joule is NEVER MEASURED",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
)
|
| 247 |
|
| 248 |
|
|
|
|
| 271 |
# reachable / gpu_reachable are REAL-PROBE-ONLY facts.
|
| 272 |
nodes_reachable=reachable_n,
|
| 273 |
gpu_reachable=gpu_reachable,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
)
|
| 275 |
|
| 276 |
|
|
|
|
| 281 |
import szl_restraint as rs
|
| 282 |
info = rs.info()
|
| 283 |
doctrine = info.get("doctrine", {}) or {}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
return _tile(
|
| 285 |
+
"Governance / restraint", "governance", status="OK (codified doctrine + signed receipts)",
|
| 286 |
label=MEASURED,
|
| 287 |
provenance={
|
| 288 |
"endpoint": f"{_API}/restraint/info",
|
| 289 |
+
"kind": "codified restraint ladder; each decision -> a signed DSSE receipt",
|
|
|
|
| 290 |
"doctrine_version": doctrine.get("version"),
|
| 291 |
"kernel_commit": doctrine.get("kernel_commit"),
|
| 292 |
},
|
| 293 |
+
signed_receipts=doctrine.get("signed_receipts"),
|
|
|
|
|
|
|
|
|
|
| 294 |
runtime_cdn=doctrine.get("runtime_cdn"),
|
| 295 |
lambda_=doctrine.get("lambda"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
)
|
| 297 |
|
| 298 |
|
| 299 |
def _concept_tile_inference_provenance() -> dict:
|
| 300 |
"""#1 frontier play — composite inference-provenance receipt (the inference-side C2PA).
|
| 301 |
|
| 302 |
+
LIVE capability, surfaced by READING the shared provenance Khipu chain — this tile
|
| 303 |
+
NEVER mints a receipt. The capstone surface szl_provenance_receipt composes ONE signed
|
| 304 |
+
Khipu envelope binding every guarantee for a single governed action (immune verdict +
|
| 305 |
PAC-Bayes bound + MEASURED/MODELED/SAMPLE energy label + governed model identity + Lean
|
| 306 |
+
backing) — but a receipt is signed ONLY when a real governed action POSTs
|
| 307 |
+
/provenance/receipt, never just because someone loaded this page. Here we READ the
|
|
|
|
| 308 |
chain head (depth + most-recent composite digest, if any) and re-verify chain
|
| 309 |
integrity, so the tile honestly DESCRIBES the capability and points to where the real
|
| 310 |
artifacts live (/provenance/receipt + the energy ledger) without growing the chain.
|
| 311 |
Honesty held: a GET does not fabricate or mint a composite; if no composite exists yet
|
| 312 |
+
the tile says so honestly (ROADMAP, awaiting first real action)."""
|
| 313 |
import szl_khipu
|
| 314 |
import szl_provenance_receipt as pr
|
| 315 |
|
|
|
|
| 320 |
head = dag.head()
|
| 321 |
# Most-recent composite digest already on the chain (a READ, never a mint).
|
| 322 |
last_composite = None
|
|
|
|
| 323 |
for r in reversed(dag.tail(depth or 1)):
|
| 324 |
if r.get("action") == "provenance.composite":
|
| 325 |
last_composite = r.get("digest")
|
|
|
|
| 326 |
break
|
| 327 |
|
| 328 |
minted = last_composite is not None
|
| 329 |
+
if minted:
|
| 330 |
+
status = (f"LIVE ({depth} signed receipts on the provenance chain; latest composite "
|
| 331 |
+
"binds immune verdict + PAC-Bayes bound + energy label + governed model "
|
| 332 |
+
"identity + Lean backing). Receipts mint ONLY on a real POST, never on a GET.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 333 |
label = MEASURED
|
| 334 |
+
note = ("inference-side C2PA, LIVE: each composite is a single signed Khipu envelope "
|
| 335 |
+
"composing the REAL immune verdict, the PAC-Bayes bound (ROADMAP Lean), the "
|
|
|
|
| 336 |
"MEASURED/MODELED/SAMPLE energy label, the governed model identity, and the "
|
| 337 |
+
"exact Lean backing. Each part KEEPS its own label; no label is upgraded; the "
|
| 338 |
+
"signature is the honest DSSE_PLACEHOLDER. This tile READS the chain — it does "
|
| 339 |
"NOT mint a receipt per page view. POST the endpoint to mint one for a real "
|
| 340 |
"action, then GET it back by digest.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
else:
|
| 342 |
+
status = ("ROADMAP (capability wired; no composite minted yet this process — a signed "
|
| 343 |
+
"composite is created ONLY when a real governed action POSTs the endpoint)")
|
| 344 |
+
label = ROADMAP
|
| 345 |
+
note = ("inference-side C2PA capability is wired but no composite has been minted in "
|
| 346 |
+
"this process yet. A signed composite is created ONLY on a real POST to "
|
|
|
|
| 347 |
"/provenance/receipt (immune verdict + PAC-Bayes bound + energy label + "
|
| 348 |
"governed model identity + Lean backing) — never fabricated, never minted by "
|
| 349 |
"loading this manifest.")
|
|
|
|
| 352 |
"Composite inference-provenance receipt", "frontier-concept",
|
| 353 |
status=status, label=label,
|
| 354 |
provenance={
|
| 355 |
+
"kind": "composite composed in-process by CALLING the live surfaces and signed "
|
| 356 |
+
"into the shared provenance Khipu chain (signature = honest "
|
| 357 |
+
"DSSE_PLACEHOLDER, cosign founder-gated); this manifest tile READS the "
|
| 358 |
+
"chain head and NEVER mints a receipt per page view",
|
| 359 |
"endpoint": f"{_API}/provenance/receipt",
|
| 360 |
# Composite receipts live in the shared szl_khipu `provenance` organ, so a
|
| 361 |
# judge can re-verify a composite digest TWO honest ways: the composite
|
|
|
|
| 368 |
"latest_composite_digest": last_composite,
|
| 369 |
"chain_head": head,
|
| 370 |
"chain_verified": chain.get("ok"),
|
|
|
|
|
|
|
|
|
|
| 371 |
"composes_measured": f"{_API}/immune/verdict (REAL fail-closed gate) + the "
|
| 372 |
"MEASURED energy joule-truth path",
|
| 373 |
+
"composes_roadmap": f"{_API}/materials/certify (PAC-Bayes bound; Lean SORRY/ROADMAP)",
|
|
|
|
| 374 |
},
|
| 375 |
# READ facts straight off the chain — this tile mints nothing on a GET.
|
| 376 |
on_artifact_minted=minted,
|
| 377 |
composite_digest=last_composite,
|
| 378 |
chain_ok=chain.get("ok"),
|
| 379 |
chain_length=depth,
|
|
|
|
|
|
|
| 380 |
note=note,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 381 |
)
|
| 382 |
|
| 383 |
|
|
|
|
| 386 |
_TILE_SPECS: list[tuple[Callable[[], dict], str, str, dict]] = [
|
| 387 |
(_tile_energy_operator, "Energy operator", "energy",
|
| 388 |
{"endpoint": f"{_API}/energy/operator/status"}),
|
| 389 |
+
(_tile_energy_ledger, "Signed energy ledger", "energy",
|
| 390 |
{"endpoint": f"{_API}/energy/ledger"}),
|
| 391 |
(_tile_energy_provenance, "Energy provenance chain", "provenance",
|
| 392 |
{"endpoint": f"{_API}/energy/provenance"}),
|
|
|
|
| 430 |
tiles.append(tile if tile is not None
|
| 431 |
else _unavailable_tile(name, category, prov, err or "unknown error"))
|
| 432 |
|
| 433 |
+
# #1 frontier play — always present, always ROADMAP, never a fabricated artifact.
|
|
|
|
| 434 |
concept, c_err = _safe(_concept_tile_inference_provenance)
|
| 435 |
if concept is None: # pragma: no cover — the concept tile is pure data
|
| 436 |
concept = _unavailable_tile("Composite inference-provenance receipt",
|
|
|
|
| 441 |
for t in tiles:
|
| 442 |
label_counts[t["label"]] = label_counts.get(t["label"], 0) + 1
|
| 443 |
degraded = [t["name"] for t in tiles if not t.get("ok", True)]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 444 |
|
| 445 |
return {
|
| 446 |
"ok": True,
|
| 447 |
"endpoint": "frontier/manifest",
|
| 448 |
"service": "a11oy.frontier.manifest",
|
| 449 |
"what": ("one honest roll-up of the SZL governed-provenance ecosystem — every "
|
| 450 |
+
"capability as a tile with its MEASURED/MODELED/ROADMAP/SAMPLE label and "
|
| 451 |
"a provenance pointer. Composed live, in-process, from the wired surfaces."),
|
| 452 |
"doctrine": (
|
| 453 |
"v11: REAL composed data only. No label is upgraded (orbital stays MODELED, "
|
| 454 |
"ROADMAP stays ROADMAP). reachable/running/survives_redeploy are REAL-PROBE-ONLY "
|
| 455 |
"and read straight from the live surfaces. A down sub-source yields an honest "
|
| 456 |
+
"UNAVAILABLE tile, never a fabricated OK. The #1 frontier composite receipt is a "
|
| 457 |
+
"ROADMAP concept that names its parts — no composite artifact is minted. "
|
| 458 |
"Λ = Conjecture 1."
|
| 459 |
),
|
| 460 |
"universal_verifier": {
|
| 461 |
+
"what": "judge-facing audit layer: paste ANY receipt digest from ANY shared "
|
| 462 |
"szl_khipu organ (immune, materials, kverify, provenance, sda, "
|
| 463 |
+
"nemo_agents) and get an INDEPENDENT, COMPUTED PASS|FAIL|NOT_FOUND",
|
| 464 |
"verify_post": _KHIPU_VERIFY,
|
| 465 |
"verify_link": _KHIPU_VERIFY_PATH,
|
| 466 |
"organs": _KHIPU_ORGANS,
|
| 467 |
+
"method": "SHA3-256 seal recompute (the exact szl_khipu sealing scheme) + "
|
| 468 |
+
"prev-link re-walk to genesis; digest_matches + "
|
| 469 |
+
"chain_to_genesis_verified are COMPUTED, never asserted",
|
| 470 |
+
"signature_status": "DSSE_PLACEHOLDER (cosign founder-gated; never faked)",
|
| 471 |
+
"khipu_kind": "Conjecture 2 (chain INTEGRITY real; BFT/consensus is the conjecture)",
|
|
|
|
|
|
|
|
|
|
| 472 |
},
|
| 473 |
"labels_legend": {
|
| 474 |
+
"MEASURED": "real measured/shipped capability (e.g. signed joule receipts, REAL probes)",
|
|
|
|
| 475 |
"MODELED": "design artifact derived from a real measurement (e.g. orbital joules from ground coeff)",
|
| 476 |
"ROADMAP": "named forward work; no fabricated artifact",
|
| 477 |
"SAMPLE": "illustrative sample value, never billable/live",
|
| 478 |
+
"UNAVAILABLE": "sub-source down right now — reported honestly, not faked",
|
| 479 |
},
|
| 480 |
"summary": {
|
| 481 |
"tiles": len(tiles),
|
| 482 |
"label_counts": label_counts,
|
| 483 |
"degraded_tiles": degraded,
|
| 484 |
+
"all_sources_live": len(degraded) == 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 485 |
},
|
| 486 |
"capabilities": tiles,
|
| 487 |
"timestamp_utc": _now_iso(),
|
|
|
|
| 574 |
|
| 575 |
# 4) the #1 frontier composite tile READS the provenance chain; it NEVER mints a
|
| 576 |
# receipt on a manifest GET. A fresh process has an empty provenance chain, so the
|
| 577 |
+
# tile is honestly ROADMAP / no-artifact; building the manifest must not grow it.
|
| 578 |
import szl_khipu as _kh
|
| 579 |
import szl_provenance_receipt as _pr
|
| 580 |
_prov = _kh.get_dag(_pr._KHIPU_ORGAN, ns="a11oy")
|
|
|
|
| 584 |
assert _after == _before, (
|
| 585 |
f"manifest GET must NOT mint a provenance receipt (chain grew {_before}->{_after})")
|
| 586 |
concept = next(t for t in tiles if t["category"] == "frontier-concept")
|
| 587 |
+
assert concept["label"] in (ROADMAP, MEASURED), concept["label"]
|
| 588 |
+
# On a fresh process (empty chain) the tile is honestly ROADMAP with no artifact.
|
| 589 |
if _before == 0:
|
| 590 |
+
assert concept["label"] == ROADMAP, "empty chain -> honest ROADMAP, no fabricated artifact"
|
|
|
|
| 591 |
assert concept.get("on_artifact_minted") is False, "no composite minted by a GET"
|
| 592 |
assert concept.get("composite_digest") is None, "no digest fabricated on a GET"
|
| 593 |
assert concept["provenance"].get("chain_verified") is True, "provenance chain must verify"
|
|
|
|
| 596 |
|
| 597 |
# 5) labels legend + summary present; degraded tiles (if any) reported honestly
|
| 598 |
assert "labels_legend" in m and "summary" in m
|
|
|
|
|
|
|
| 599 |
print(f"[5] summary: {_json.dumps(m['summary'])}")
|
| 600 |
|
| 601 |
print("\n--- tiles (name / label / status) ---")
|
|
|
|
| 603 |
print(f" - {t['name']:38s} {t['label']:11s} {t['status']}")
|
| 604 |
print("\nok:true checks:5")
|
| 605 |
_sys.exit(0)
|
| 606 |
+
|
| 607 |
+
|
szl_gpu_quant.py
CHANGED
|
@@ -30,10 +30,10 @@ HONESTY SPINE (doctrine v11 — the non-negotiable part of this build):
|
|
| 30 |
(cuML LedoitWolf + cuPy eigh + giotto-tda / Ripser++) is labeled ROADMAP. GPU
|
| 31 |
reachability and dependency imports are readiness only; MEASURED requires a distinct
|
| 32 |
accelerated path plus device/kernel/timing execution evidence.
|
| 33 |
-
* Every receipt is
|
| 34 |
-
is present in the runtime;
|
| 35 |
-
signature). The label SAMPLE_SIGNAL | NOT_LIVE | NO_BACKTEST_VALIDATED is
|
| 36 |
-
in the
|
| 37 |
* No fabricated metric. No live-trading claim. No backtest claim. cuML speedups are
|
| 38 |
cited to NVIDIA/STAC docs, never asserted as SZL-measured.
|
| 39 |
|
|
@@ -41,7 +41,7 @@ Routes (NEW; never collide):
|
|
| 41 |
GET /api/{ns}/v1/quant/pca — Layer 1 PCA-Risk (LW + MP) on a SAMPLE universe
|
| 42 |
GET /api/{ns}/v1/quant/tda — Layer 2 TDA fracture score f_t, z_t, Betti β0/β1
|
| 43 |
GET /api/{ns}/v1/quant/kelly — Layer 3 HJB-Kelly weights w* with σ²_eff
|
| 44 |
-
GET /api/{ns}/v1/quant/pipeline — full 3-layer pass + ONE
|
| 45 |
GET /api/{ns}/v1/quant/tiers — 2-GPU serve tier panel (TP=2 / role-split / NIM cloud)
|
| 46 |
GET /api/{ns}/v1/quant/verify-claims — NVIDIA datasheet vs SZL-MEASURED (honest, empty/ROADMAP)
|
| 47 |
GET /quant — unified mobile-first "Quant Engine" tab (0 CDN)
|
|
@@ -50,12 +50,10 @@ Pure stdlib. Defensive: a compute failure NEVER raises out of a handler.
|
|
| 50 |
"""
|
| 51 |
from __future__ import annotations
|
| 52 |
|
| 53 |
-
import base64 as _base64
|
| 54 |
import hashlib as _hashlib
|
| 55 |
import json as _json
|
| 56 |
import math as _math
|
| 57 |
import os as _os
|
| 58 |
-
from pathlib import Path as _Path
|
| 59 |
import random as _random
|
| 60 |
import time as _time
|
| 61 |
from datetime import datetime, timezone
|
|
@@ -63,7 +61,6 @@ from datetime import datetime, timezone
|
|
| 63 |
# --- signed receipts: the SINGLE source of truth (never fabricate a signature) ----
|
| 64 |
try:
|
| 65 |
from szl_dsse import sign_payload as _sign_payload # REAL ECDSA when key present
|
| 66 |
-
from szl_dsse import verify_envelope as _verify_envelope
|
| 67 |
_SIGN_AVAILABLE = True
|
| 68 |
except Exception: # pragma: no cover — defensive; honest unsigned fallback below
|
| 69 |
_SIGN_AVAILABLE = False
|
|
@@ -82,9 +79,6 @@ except Exception: # pragma: no cover — defensive; honest unsigned fallback be
|
|
| 82 |
"no signature fabricated."),
|
| 83 |
}
|
| 84 |
|
| 85 |
-
def _verify_envelope(_envelope): # type: ignore
|
| 86 |
-
return {"verified": False, "reason": "szl_dsse verifier is unavailable"}
|
| 87 |
-
|
| 88 |
_QUANT_PAYLOAD_TYPE = "application/vnd.szl.quant.receipt+json"
|
| 89 |
|
| 90 |
# --- optional acceleration probes (honest GPU-path labels) ------------------------
|
|
@@ -670,10 +664,10 @@ def layer3_hjb_kelly(l1=None, l2=None, gamma=0.5, kappa=1.0, stress=False):
|
|
| 670 |
|
| 671 |
|
| 672 |
# =====================================================================================
|
| 673 |
-
# FULL PIPELINE -> ONE
|
| 674 |
# =====================================================================================
|
| 675 |
def run_pipeline(stress=False, gamma=0.5, kappa=1.0) -> dict:
|
| 676 |
-
"""Full 3-layer pass
|
| 677 |
returns = _sample_returns(stress=stress)
|
| 678 |
l1 = layer1_pca_risk(returns=returns, stress=stress)
|
| 679 |
l2 = layer2_tda_fracture(returns=returns, stress=stress)
|
|
@@ -821,7 +815,7 @@ def tiers_panel() -> dict:
|
|
| 821 |
# =====================================================================================
|
| 822 |
# VERIFY-THE-CLAIMS panel: NVIDIA datasheet vs SZL-MEASURED (honest; empty/ROADMAP).
|
| 823 |
# =====================================================================================
|
| 824 |
-
def
|
| 825 |
"""Side-by-side NVIDIA datasheet numbers vs SZL-MEASURED (signed). Honest: SZL columns
|
| 826 |
are empty/ROADMAP until we actually measure on OUR harness. NEVER print the datasheet
|
| 827 |
number as if it were ours."""
|
|
@@ -861,366 +855,6 @@ def _legacy_verify_claims_panel() -> dict:
|
|
| 861 |
}
|
| 862 |
|
| 863 |
|
| 864 |
-
# =====================================================================================
|
| 865 |
-
# Receipt-gated local verification. The legacy static panel above is retained only as
|
| 866 |
-
# historical code; this definition is authoritative for routes and the UI.
|
| 867 |
-
# =====================================================================================
|
| 868 |
-
_QUANT_RECEIPT_SCHEMA = "szl.quant-live-benchmark-receipt.v1"
|
| 869 |
-
_QUANT_RECEIPT_SCOPE = "bounded local execution; not a replication of vendor-scale claims"
|
| 870 |
-
_QUANT_RECEIPT_PAYLOAD_TYPE = "application/vnd.szl.quant-live-benchmark+json"
|
| 871 |
-
|
| 872 |
-
|
| 873 |
-
def _dsse_signature_state(dsse):
|
| 874 |
-
"""Classify a DSSE envelope from cryptographic evidence, not its flag."""
|
| 875 |
-
if not isinstance(dsse, dict):
|
| 876 |
-
return "INVALID_SIGNATURE"
|
| 877 |
-
signatures = dsse.get("signatures")
|
| 878 |
-
if not isinstance(signatures, list):
|
| 879 |
-
return "INVALID_SIGNATURE"
|
| 880 |
-
if dsse.get("signed") is True:
|
| 881 |
-
verdict = _verify_envelope(dsse)
|
| 882 |
-
if isinstance(verdict, dict) and verdict.get("verified") is True:
|
| 883 |
-
return "SIGNED_VERIFIED"
|
| 884 |
-
return "INVALID_SIGNATURE"
|
| 885 |
-
if signatures:
|
| 886 |
-
return "INVALID_SIGNATURE"
|
| 887 |
-
return "UNSIGNED_CONTENT_ADDRESSED"
|
| 888 |
-
|
| 889 |
-
|
| 890 |
-
def _finite_number(value, field, minimum=None, maximum=None):
|
| 891 |
-
if isinstance(value, bool) or not isinstance(value, (int, float)) or not _math.isfinite(float(value)):
|
| 892 |
-
raise ValueError("%s must be a finite number" % field)
|
| 893 |
-
number = float(value)
|
| 894 |
-
if minimum is not None and number < minimum:
|
| 895 |
-
raise ValueError("%s is below its allowed minimum" % field)
|
| 896 |
-
if maximum is not None and number > maximum:
|
| 897 |
-
raise ValueError("%s exceeds its allowed maximum" % field)
|
| 898 |
-
return number
|
| 899 |
-
|
| 900 |
-
|
| 901 |
-
def _bounded_int(value, field, minimum=0, maximum=1_000_000):
|
| 902 |
-
if isinstance(value, bool) or not isinstance(value, int) or not minimum <= value <= maximum:
|
| 903 |
-
raise ValueError("%s must be an integer between %s and %s" % (field, minimum, maximum))
|
| 904 |
-
return value
|
| 905 |
-
|
| 906 |
-
|
| 907 |
-
def _aware_timestamp(value, field):
|
| 908 |
-
if not isinstance(value, str) or not value.strip():
|
| 909 |
-
raise ValueError("%s missing" % field)
|
| 910 |
-
try:
|
| 911 |
-
parsed = datetime.fromisoformat(value.replace("Z", "+00:00"))
|
| 912 |
-
except ValueError as exc:
|
| 913 |
-
raise ValueError("%s is not an ISO-8601 timestamp" % field) from exc
|
| 914 |
-
if parsed.tzinfo is None or parsed.utcoffset() is None:
|
| 915 |
-
raise ValueError("%s must include a timezone" % field)
|
| 916 |
-
return parsed.astimezone(timezone.utc)
|
| 917 |
-
|
| 918 |
-
|
| 919 |
-
def _validate_model_identity(identity, measurement, role):
|
| 920 |
-
if not isinstance(identity, dict):
|
| 921 |
-
raise ValueError("%s identity missing" % role)
|
| 922 |
-
if not isinstance(measurement, dict):
|
| 923 |
-
raise ValueError("%s measurement missing" % role)
|
| 924 |
-
requested = identity.get("requested_model")
|
| 925 |
-
if not isinstance(requested, str) or not requested.strip() or requested != measurement.get("model"):
|
| 926 |
-
raise ValueError("%s identity does not match measured model" % role)
|
| 927 |
-
manifest_hash = identity.get("show_response_sha256")
|
| 928 |
-
if not isinstance(manifest_hash, str) or len(manifest_hash) != 64:
|
| 929 |
-
raise ValueError("%s identity manifest hash missing" % role)
|
| 930 |
-
try:
|
| 931 |
-
int(manifest_hash, 16)
|
| 932 |
-
except ValueError as exc:
|
| 933 |
-
raise ValueError("%s identity manifest hash is not SHA-256" % role) from exc
|
| 934 |
-
lineage = identity.get("base_lineage")
|
| 935 |
-
if not isinstance(lineage, dict) or not any(
|
| 936 |
-
isinstance(lineage.get(key), str) and lineage.get(key).strip()
|
| 937 |
-
for key in ("base_ref", "parent_model", "base_digest")
|
| 938 |
-
):
|
| 939 |
-
raise ValueError("%s base lineage missing" % role)
|
| 940 |
-
wall_ms = identity.get("show_wall_ms")
|
| 941 |
-
if wall_ms is not None:
|
| 942 |
-
_finite_number(wall_ms, "%s identity show_wall_ms" % role, 0.0)
|
| 943 |
-
return manifest_hash.lower()
|
| 944 |
-
|
| 945 |
-
|
| 946 |
-
def _validate_model_measurement(measurement, role):
|
| 947 |
-
if not isinstance(measurement, dict):
|
| 948 |
-
raise ValueError("%s measurement missing" % role)
|
| 949 |
-
exact = measurement.get("exact_match")
|
| 950 |
-
retrieval = measurement.get("bounded_retrieval")
|
| 951 |
-
runtime = measurement.get("runtime")
|
| 952 |
-
if not isinstance(exact, dict) or not isinstance(retrieval, dict) or not isinstance(runtime, dict):
|
| 953 |
-
raise ValueError("%s semantic measurement sections missing" % role)
|
| 954 |
-
total = _bounded_int(exact.get("tasks_total"), "%s tasks_total" % role, 1, 10_000)
|
| 955 |
-
passed = _bounded_int(exact.get("tasks_passed"), "%s tasks_passed" % role, 0, total)
|
| 956 |
-
accuracy = _finite_number(exact.get("accuracy_pct"), "%s accuracy_pct" % role, 0.0, 100.0)
|
| 957 |
-
expected_accuracy = 100.0 * passed / total
|
| 958 |
-
if abs(accuracy - expected_accuracy) > 0.001:
|
| 959 |
-
raise ValueError("%s accuracy_pct is inconsistent with pass counts" % role)
|
| 960 |
-
probes_total = _bounded_int(retrieval.get("probes_total"), "%s probes_total" % role, 1, 10_000)
|
| 961 |
-
_bounded_int(retrieval.get("probes_passed"), "%s probes_passed" % role, 0, probes_total)
|
| 962 |
-
_bounded_int(
|
| 963 |
-
retrieval.get("max_prompt_eval_tokens"), "%s max_prompt_eval_tokens" % role, 0, 10_000_000
|
| 964 |
-
)
|
| 965 |
-
_bounded_int(runtime.get("requests"), "%s runtime requests" % role, 1, 100_000)
|
| 966 |
-
latency = _finite_number(runtime.get("p50_wall_ms"), "%s p50_wall_ms" % role, 0.000001)
|
| 967 |
-
tps = runtime.get("p50_tokens_per_second")
|
| 968 |
-
if tps is not None:
|
| 969 |
-
_finite_number(tps, "%s p50_tokens_per_second" % role, 0.000001)
|
| 970 |
-
return {"accuracy": accuracy, "latency": latency}
|
| 971 |
-
|
| 972 |
-
|
| 973 |
-
def _validate_cpu_reference(reference, field):
|
| 974 |
-
if not isinstance(reference, dict):
|
| 975 |
-
raise ValueError("%s missing" % field)
|
| 976 |
-
_bounded_int(reference.get("repeats"), "%s repeats" % field, 1, 20)
|
| 977 |
-
minimum = _finite_number(reference.get("min_ms"), "%s min_ms" % field, 0.0)
|
| 978 |
-
p50 = _finite_number(reference.get("p50_ms"), "%s p50_ms" % field, 0.0)
|
| 979 |
-
maximum = _finite_number(reference.get("max_ms"), "%s max_ms" % field, 0.0)
|
| 980 |
-
if minimum > p50 or p50 > maximum:
|
| 981 |
-
raise ValueError("%s latency order is inconsistent" % field)
|
| 982 |
-
if reference.get("compute_path") != "CPU_REFERENCE":
|
| 983 |
-
raise ValueError("%s is not an explicit CPU reference" % field)
|
| 984 |
-
return p50
|
| 985 |
-
|
| 986 |
-
|
| 987 |
-
def _validate_quant_receipt(envelope):
|
| 988 |
-
if not isinstance(envelope, dict):
|
| 989 |
-
raise ValueError("receipt envelope missing")
|
| 990 |
-
receipt = envelope.get("receipt")
|
| 991 |
-
if not isinstance(receipt, dict):
|
| 992 |
-
raise ValueError("receipt object missing")
|
| 993 |
-
if receipt.get("schema_version") != _QUANT_RECEIPT_SCHEMA:
|
| 994 |
-
raise ValueError("unsupported receipt schema")
|
| 995 |
-
if receipt.get("measurement_class") != "MEASURED":
|
| 996 |
-
raise ValueError("receipt is not a completed MEASURED execution")
|
| 997 |
-
if receipt.get("scope") != _QUANT_RECEIPT_SCOPE:
|
| 998 |
-
raise ValueError("receipt scope is not the bounded local harness")
|
| 999 |
-
|
| 1000 |
-
claimed_digest = receipt.get("content_sha256")
|
| 1001 |
-
unsigned_body = dict(receipt)
|
| 1002 |
-
unsigned_body.pop("content_sha256", None)
|
| 1003 |
-
observed_digest = _hashlib.sha256(
|
| 1004 |
-
_json.dumps(unsigned_body, sort_keys=True, separators=(",", ":"), ensure_ascii=False).encode("utf-8")
|
| 1005 |
-
).hexdigest()
|
| 1006 |
-
if claimed_digest != observed_digest:
|
| 1007 |
-
raise ValueError("content digest mismatch")
|
| 1008 |
-
|
| 1009 |
-
started = _aware_timestamp(receipt.get("started_at"), "started_at")
|
| 1010 |
-
completed = _aware_timestamp(receipt.get("completed_at"), "completed_at")
|
| 1011 |
-
now = datetime.now(timezone.utc)
|
| 1012 |
-
if completed < started:
|
| 1013 |
-
raise ValueError("completed_at precedes started_at")
|
| 1014 |
-
if completed.timestamp() > now.timestamp() + 300:
|
| 1015 |
-
raise ValueError("completed_at is implausibly in the future")
|
| 1016 |
-
|
| 1017 |
-
ollama = receipt.get("ollama")
|
| 1018 |
-
if not isinstance(ollama, dict) or ollama.get("base_url_class") != "loopback-local":
|
| 1019 |
-
raise ValueError("receipt is not bound to a loopback-local Ollama endpoint")
|
| 1020 |
-
candidate = ollama.get("candidate")
|
| 1021 |
-
baseline = ollama.get("baseline")
|
| 1022 |
-
c_identity = _validate_model_identity(ollama.get("candidate_identity"), candidate, "candidate")
|
| 1023 |
-
b_identity = _validate_model_identity(ollama.get("baseline_identity"), baseline, "baseline")
|
| 1024 |
-
if c_identity == b_identity:
|
| 1025 |
-
raise ValueError("candidate and baseline resolve to the same manifest")
|
| 1026 |
-
stability = ollama.get("identity_stability")
|
| 1027 |
-
if not isinstance(stability, dict) or stability.get("stable") is not True:
|
| 1028 |
-
raise ValueError("model identity stability is not proven")
|
| 1029 |
-
if not (
|
| 1030 |
-
stability.get("candidate_before_sha256") == c_identity
|
| 1031 |
-
and stability.get("candidate_after_sha256") == c_identity
|
| 1032 |
-
and stability.get("baseline_before_sha256") == b_identity
|
| 1033 |
-
and stability.get("baseline_after_sha256") == b_identity
|
| 1034 |
-
):
|
| 1035 |
-
raise ValueError("model identity drift detected in receipt")
|
| 1036 |
-
|
| 1037 |
-
candidate_metrics = _validate_model_measurement(candidate, "candidate")
|
| 1038 |
-
baseline_metrics = _validate_model_measurement(baseline, "baseline")
|
| 1039 |
-
comparisons = receipt.get("comparisons")
|
| 1040 |
-
if not isinstance(comparisons, dict):
|
| 1041 |
-
raise ValueError("comparison metrics missing")
|
| 1042 |
-
speed = _finite_number(
|
| 1043 |
-
comparisons.get("candidate_vs_baseline_wall_speed_ratio"), "wall speed ratio", 0.000001
|
| 1044 |
-
)
|
| 1045 |
-
expected_speed = baseline_metrics["latency"] / candidate_metrics["latency"]
|
| 1046 |
-
if abs(speed - expected_speed) > 0.0001:
|
| 1047 |
-
raise ValueError("wall speed ratio is inconsistent with measured latency")
|
| 1048 |
-
uplift = _finite_number(
|
| 1049 |
-
comparisons.get("candidate_minus_baseline_exact_match_points"), "accuracy uplift", -100.0, 100.0
|
| 1050 |
-
)
|
| 1051 |
-
expected_uplift = candidate_metrics["accuracy"] - baseline_metrics["accuracy"]
|
| 1052 |
-
if abs(uplift - expected_uplift) > 0.001:
|
| 1053 |
-
raise ValueError("accuracy uplift is inconsistent with measured accuracy")
|
| 1054 |
-
|
| 1055 |
-
quant_reference = receipt.get("quant_reference")
|
| 1056 |
-
if not isinstance(quant_reference, dict):
|
| 1057 |
-
raise ValueError("quant reference section missing")
|
| 1058 |
-
_validate_cpu_reference(quant_reference.get("pca_pipeline"), "pca_pipeline")
|
| 1059 |
-
_validate_cpu_reference(quant_reference.get("tda_stress_pipeline"), "tda_stress_pipeline")
|
| 1060 |
-
gpu_comparison = quant_reference.get("gpu_acceleration_comparison")
|
| 1061 |
-
if not isinstance(gpu_comparison, str) or not gpu_comparison.startswith("UNAVAILABLE:"):
|
| 1062 |
-
raise ValueError("GPU acceleration status is not an explicit structured refusal")
|
| 1063 |
-
|
| 1064 |
-
dsse = envelope.get("dsse")
|
| 1065 |
-
if not isinstance(dsse, dict):
|
| 1066 |
-
raise ValueError("DSSE status missing")
|
| 1067 |
-
signatures = dsse.get("signatures")
|
| 1068 |
-
if not isinstance(signatures, list):
|
| 1069 |
-
raise ValueError("DSSE signatures must be a list")
|
| 1070 |
-
embedded = dsse.get("payload")
|
| 1071 |
-
if embedded is not None:
|
| 1072 |
-
if dsse.get("payloadType") != _QUANT_RECEIPT_PAYLOAD_TYPE:
|
| 1073 |
-
raise ValueError("DSSE payload type mismatch")
|
| 1074 |
-
try:
|
| 1075 |
-
decoded = _base64.b64decode(embedded, validate=True)
|
| 1076 |
-
except Exception as exc:
|
| 1077 |
-
raise ValueError("DSSE payload is not valid base64") from exc
|
| 1078 |
-
expected = _json.dumps(receipt, sort_keys=True, separators=(",", ":"), ensure_ascii=False).encode("utf-8")
|
| 1079 |
-
if decoded != expected:
|
| 1080 |
-
raise ValueError("DSSE payload does not match receipt")
|
| 1081 |
-
if dsse.get("signed") is True:
|
| 1082 |
-
if not signatures or embedded is None:
|
| 1083 |
-
raise ValueError("DSSE claims signed without signatures and payload")
|
| 1084 |
-
verdict = _verify_envelope(dsse)
|
| 1085 |
-
if not isinstance(verdict, dict) or verdict.get("verified") is not True:
|
| 1086 |
-
reason = verdict.get("reason") if isinstance(verdict, dict) else None
|
| 1087 |
-
suffix = ": " + str(reason) if reason else ""
|
| 1088 |
-
raise ValueError("DSSE signature verification failed" + suffix)
|
| 1089 |
-
signature_state = "SIGNED_VERIFIED"
|
| 1090 |
-
elif signatures:
|
| 1091 |
-
raise ValueError("unsigned DSSE contains signatures")
|
| 1092 |
-
else:
|
| 1093 |
-
signature_state = "UNSIGNED_CONTENT_ADDRESSED"
|
| 1094 |
-
|
| 1095 |
-
raw_fresh_seconds = _os.environ.get("SZL_QUANT_BENCH_FRESH_SECONDS", "604800")
|
| 1096 |
-
try:
|
| 1097 |
-
fresh_seconds = int(raw_fresh_seconds)
|
| 1098 |
-
except ValueError as exc:
|
| 1099 |
-
raise ValueError("SZL_QUANT_BENCH_FRESH_SECONDS must be an integer") from exc
|
| 1100 |
-
if not 60 <= fresh_seconds <= 2_678_400:
|
| 1101 |
-
raise ValueError("SZL_QUANT_BENCH_FRESH_SECONDS is outside the allowed range")
|
| 1102 |
-
age_seconds = max(0, int((now - completed).total_seconds()))
|
| 1103 |
-
return {
|
| 1104 |
-
"envelope": envelope,
|
| 1105 |
-
"age_seconds": age_seconds,
|
| 1106 |
-
"freshness_state": "CURRENT" if age_seconds <= fresh_seconds else "HISTORICAL",
|
| 1107 |
-
"candidate_manifest_sha256": c_identity,
|
| 1108 |
-
"baseline_manifest_sha256": b_identity,
|
| 1109 |
-
"signature_state": signature_state,
|
| 1110 |
-
}
|
| 1111 |
-
|
| 1112 |
-
|
| 1113 |
-
def verify_claims_panel() -> dict:
|
| 1114 |
-
"""Read a bounded local benchmark receipt without producing side effects.
|
| 1115 |
-
|
| 1116 |
-
Missing, semantically inconsistent, stale-looking, or tampered data never
|
| 1117 |
-
becomes a live claim. Valid old receipts remain visible as HISTORICAL.
|
| 1118 |
-
"""
|
| 1119 |
-
configured_path = _os.environ.get("SZL_QUANT_BENCH_RECEIPT", "").strip()
|
| 1120 |
-
receipt_candidates = ([_Path(configured_path)] if configured_path else [
|
| 1121 |
-
_Path.home() / ".a11oy" / "receipts" / "quant-live-benchmark.json",
|
| 1122 |
-
_Path(__file__).resolve().parent / "benchmarks" / "quant_live" / "receipts" / "latest.json",
|
| 1123 |
-
])
|
| 1124 |
-
receipt_path = next((path for path in receipt_candidates if path.is_file()), receipt_candidates[0])
|
| 1125 |
-
measured = None
|
| 1126 |
-
validation = None
|
| 1127 |
-
receipt_error = None
|
| 1128 |
-
try:
|
| 1129 |
-
if receipt_path.is_file() and receipt_path.stat().st_size <= 2_000_000:
|
| 1130 |
-
envelope = _json.loads(receipt_path.read_text(encoding="utf-8"))
|
| 1131 |
-
validation = _validate_quant_receipt(envelope)
|
| 1132 |
-
measured = validation["envelope"]
|
| 1133 |
-
else:
|
| 1134 |
-
receipt_error = "measurement receipt absent"
|
| 1135 |
-
except (OSError, ValueError, TypeError, _json.JSONDecodeError) as exc:
|
| 1136 |
-
receipt_error = "%s: %s" % (type(exc).__name__, exc)
|
| 1137 |
-
|
| 1138 |
-
local = measured.get("receipt") if measured else {}
|
| 1139 |
-
ollama = local.get("ollama", {})
|
| 1140 |
-
candidate = ollama.get("candidate", {})
|
| 1141 |
-
baseline = ollama.get("baseline", {})
|
| 1142 |
-
comparisons = local.get("comparisons", {})
|
| 1143 |
-
quant_reference = local.get("quant_reference", {})
|
| 1144 |
-
freshness = (validation or {}).get("freshness_state", "NO_RECEIPT")
|
| 1145 |
-
signature_state = (validation or {}).get("signature_state", "NO_RECEIPT")
|
| 1146 |
-
signed = signature_state == "SIGNED_VERIFIED"
|
| 1147 |
-
|
| 1148 |
-
def cell(value, how):
|
| 1149 |
-
if measured is None:
|
| 1150 |
-
return {"szl_measured": None, "szl_label": "NOT_MEASURED", "how": how,
|
| 1151 |
-
"comparison_status": "NO_RECEIPT", "freshness_label": freshness}
|
| 1152 |
-
return {"szl_measured": value, "szl_label": "MEASURED", "how": how,
|
| 1153 |
-
"comparison_status": "BOUNDED_LOCAL_NOT_VENDOR_REPLICATION",
|
| 1154 |
-
"freshness_label": freshness}
|
| 1155 |
-
|
| 1156 |
-
def no_gpu_claim(local_reference, how):
|
| 1157 |
-
return {
|
| 1158 |
-
"szl_measured": None,
|
| 1159 |
-
"szl_label": "NOT_MEASURED",
|
| 1160 |
-
"local_reference": local_reference if measured else None,
|
| 1161 |
-
"local_reference_label": "MEASURED" if measured else "NOT_MEASURED",
|
| 1162 |
-
"how": how,
|
| 1163 |
-
"comparison_status": "NO_GPU_COMPARISON_RECEIPT" if measured else "NO_RECEIPT",
|
| 1164 |
-
"freshness_label": freshness,
|
| 1165 |
-
}
|
| 1166 |
-
|
| 1167 |
-
def vendor_row(claim, reported, values):
|
| 1168 |
-
return {"claim": claim, "nvidia_datasheet": reported, "nvidia_label": "REPORTED", **values}
|
| 1169 |
-
|
| 1170 |
-
c_acc = candidate.get("exact_match", {})
|
| 1171 |
-
c_ret = candidate.get("bounded_retrieval", {})
|
| 1172 |
-
speed = comparisons.get("candidate_vs_baseline_wall_speed_ratio")
|
| 1173 |
-
uplift = comparisons.get("candidate_minus_baseline_exact_match_points")
|
| 1174 |
-
pca = quant_reference.get("pca_pipeline", {})
|
| 1175 |
-
tda = quant_reference.get("tda_stress_pipeline", {})
|
| 1176 |
-
rows = [
|
| 1177 |
-
vendor_row("Nemotron speedup vs prior frontier", "up to 5x", no_gpu_claim(
|
| 1178 |
-
("%sx local Ollama wall-speed ratio vs %s" % (speed, baseline.get("model"))) if speed is not None else None,
|
| 1179 |
-
"Local Ollama p50 wall latency is separate evidence; no vendor-frontier or GPU comparison receipt exists.")),
|
| 1180 |
-
vendor_row("Reasoning/accuracy uplift", "+30%", cell(
|
| 1181 |
-
("%s percentage points vs local baseline" % uplift) if uplift is not None else None,
|
| 1182 |
-
"Six preregistered deterministic exact-match operational probes; not a general reasoning benchmark.")),
|
| 1183 |
-
vendor_row("Benchmark accuracy", "91%", cell(
|
| 1184 |
-
("%s%% (%s/%s exact match)" % (c_acc.get("accuracy_pct"), c_acc.get("tasks_passed"), c_acc.get("tasks_total"))) if c_acc else None,
|
| 1185 |
-
"Bounded SZL exact-match operational suite; not NVIDIA's benchmark.")),
|
| 1186 |
-
vendor_row("Long-context retrieval", "1M-token retrieval", cell(
|
| 1187 |
-
("%s/%s needles; max %s evaluated prompt tokens" % (c_ret.get("probes_passed"), c_ret.get("probes_total"), c_ret.get("max_prompt_eval_tokens"))) if c_ret else None,
|
| 1188 |
-
"Bounded local needle probes; no one-million-token claim.")),
|
| 1189 |
-
vendor_row("cuML PCA speedup (quant Layer 1)", "10-50x (S&P 500 scale); about 100x genomic", no_gpu_claim(
|
| 1190 |
-
("CPU reference p50 %s ms; GPU comparison UNAVAILABLE" % pca.get("p50_ms")) if pca else None,
|
| 1191 |
-
"Measured CPU reference only; no distinct cuML execution receipt exists.")),
|
| 1192 |
-
vendor_row("Ripser++ persistence (quant Layer 2)", "up to 30x vs CPU Ripser", no_gpu_claim(
|
| 1193 |
-
("CPU stress reference p50 %s ms; GPU comparison UNAVAILABLE" % tda.get("p50_ms")) if tda else None,
|
| 1194 |
-
"Measured CPU reference only; no distinct Ripser++ execution receipt exists.")),
|
| 1195 |
-
]
|
| 1196 |
-
for row in rows:
|
| 1197 |
-
row.setdefault("local_reference", None)
|
| 1198 |
-
row.setdefault("local_reference_label", "NOT_MEASURED")
|
| 1199 |
-
return {
|
| 1200 |
-
"service": "verify-the-claims",
|
| 1201 |
-
"doctrine": DOCTRINE["version"],
|
| 1202 |
-
"summary": (("Current" if freshness == "CURRENT" else "Historical")
|
| 1203 |
-
+ " bounded %s receipt loaded; vendor-scale and GPU comparisons remain out of scope."
|
| 1204 |
-
% ("cryptographically verified DSSE" if signed else "unsigned content-addressed")
|
| 1205 |
-
if measured else "No valid local measurement receipt is available; no number is invented."),
|
| 1206 |
-
"gpu_reachable": _gpu_reachable(),
|
| 1207 |
-
"rows": rows,
|
| 1208 |
-
"receipt": {"path_class": "operator-local", "loaded": bool(measured), "error": receipt_error,
|
| 1209 |
-
"content_sha256": local.get("content_sha256"), "completed_at": local.get("completed_at"),
|
| 1210 |
-
"dsse_signed": signed,
|
| 1211 |
-
"signature_state": signature_state,
|
| 1212 |
-
"freshness_state": freshness, "age_seconds": (validation or {}).get("age_seconds"),
|
| 1213 |
-
"candidate_manifest_sha256": (validation or {}).get("candidate_manifest_sha256"),
|
| 1214 |
-
"baseline_manifest_sha256": (validation or {}).get("baseline_manifest_sha256")},
|
| 1215 |
-
"honesty": ("The NVIDIA column is a cited vendor claim, not an endorsement. The SZL column comes from a "
|
| 1216 |
-
"bounded local execution receipt and is not presented as a vendor-scale replication. Signature "
|
| 1217 |
-
"state is derived from cryptographic verification; unsigned content-addressed evidence is never "
|
| 1218 |
-
"displayed as signed."),
|
| 1219 |
-
"citations": [CITATIONS["rapids_cuml"], CITATIONS["ripserpp"]],
|
| 1220 |
-
"computed_at": _now_iso(),
|
| 1221 |
-
}
|
| 1222 |
-
|
| 1223 |
-
|
| 1224 |
# =====================================================================================
|
| 1225 |
# Unified "Quant Engine" HTML tab (0 CDN; window.SZLLabels).
|
| 1226 |
# =====================================================================================
|
|
@@ -1256,23 +890,10 @@ def _html(pipe: dict, tiers: dict, verify: dict) -> str:
|
|
| 1256 |
+ row("de-risk ratio", fmt(l3["derisk_ratio_vs_uninflated"]))
|
| 1257 |
+ row("γ, κ", "%s, %s <small>(uncalibrated)</small>" % (l3["gamma"], l3["kappa"])))
|
| 1258 |
dsse = pipe["signed_receipt"]["dsse"]
|
| 1259 |
-
|
| 1260 |
-
pipeline_signed = pipeline_signature_state == "SIGNED_VERIFIED"
|
| 1261 |
-
pipeline_receipt_title = (
|
| 1262 |
-
"Verified Signed SAMPLE Receipt" if pipeline_signed else
|
| 1263 |
-
"Unsigned SAMPLE Receipt" if pipeline_signature_state == "UNSIGNED_CONTENT_ADDRESSED" else
|
| 1264 |
-
"Invalid DSSE SAMPLE Receipt"
|
| 1265 |
-
)
|
| 1266 |
-
pipeline_receipt_note = (
|
| 1267 |
-
"DSSE signature verified against the configured SZL public key."
|
| 1268 |
-
if pipeline_signed else
|
| 1269 |
-
"Content-addressed DSSE envelope; no verified signature is present."
|
| 1270 |
-
if pipeline_signature_state == "UNSIGNED_CONTENT_ADDRESSED" else
|
| 1271 |
-
"DSSE signature is invalid or unverifiable; this receipt is not presented as signed."
|
| 1272 |
-
)
|
| 1273 |
rc_body = (row("data source", "SAMPLE_SYNTHETIC")
|
| 1274 |
+ row("pipeline", "<code>szl-gpu-quant-v0.1</code>")
|
| 1275 |
-
+ row("
|
| 1276 |
+ row("PAE sha256", "<code>%s…</code>" % str(dsse.get("_pae_sha256", ""))[:16])
|
| 1277 |
+ row("label", "<small>%s</small>" % SAMPLE_LABEL))
|
| 1278 |
|
|
@@ -1290,27 +911,19 @@ def _html(pipe: dict, tiers: dict, verify: dict) -> str:
|
|
| 1290 |
|
| 1291 |
vrows = ""
|
| 1292 |
for r in verify["rows"]:
|
| 1293 |
-
vrows += ('<tr><td>%s</td><td class="ds"><span class="pill-slot"
|
| 1294 |
-
'
|
| 1295 |
-
|
| 1296 |
-
|
| 1297 |
-
|
| 1298 |
-
r["local_reference_label"], fmt(r["local_reference"])))
|
| 1299 |
-
verify_tbl = ('<table class="vt"><thead><tr><th>Claim</th><th>NVIDIA published</th>'
|
| 1300 |
-
'<th>SZL comparison</th><th>Separate local evidence</th></tr></thead>'
|
| 1301 |
-
'<tbody>%s</tbody></table>' % vrows)
|
| 1302 |
-
receipt_view = verify.get("receipt", {})
|
| 1303 |
-
receipt_line = ("loaded=%s · completed_at=%s · signature=%s · content_sha256=%s" % (
|
| 1304 |
-
receipt_view.get("loaded"), receipt_view.get("completed_at") or "—",
|
| 1305 |
-
receipt_view.get("signature_state") or "UNKNOWN",
|
| 1306 |
-
(str(receipt_view.get("content_sha256") or "—")[:20] + "…")
|
| 1307 |
-
if receipt_view.get("content_sha256") else "—"))
|
| 1308 |
|
| 1309 |
cards = "".join([
|
| 1310 |
card("Layer 1 · PCA Risk (LW + MP)", l1["label"].split(" | ")[0].replace("_SIGNAL", ""), l1_body, l1["honest_note"]),
|
| 1311 |
card("Layer 2 · TDA Fracture (β0/β1)", "SAMPLE", l2_body, l2["honest_note"]),
|
| 1312 |
card("Layer 3 · HJB-Kelly Sizing", "MODELED", l3_body, l3["honest_note"]),
|
| 1313 |
-
card(
|
|
|
|
|
|
|
| 1314 |
])
|
| 1315 |
|
| 1316 |
return """<!doctype html>
|
|
@@ -1346,15 +959,15 @@ def _html(pipe: dict, tiers: dict, verify: dict) -> str:
|
|
| 1346 |
<header>
|
| 1347 |
<h1>Sovereign Quant Engine</h1>
|
| 1348 |
<p class="summary">__SUMMARY__</p>
|
| 1349 |
-
<p class="sub">Three orthogonal risk signals per bar — PCA-Risk · TDA-Fracture · HJB-Kelly —
|
| 1350 |
<p class="state">backend=__BACKEND__ · gpu_reachable=__REACH__ · scenario=__SCEN__</p>
|
| 1351 |
</header>
|
| 1352 |
-
<h2>3-Layer Pipeline (
|
| 1353 |
<section class="grid">__CARDS__</section>
|
| 1354 |
<h2>2-GPU Sovereign Serve · Throttle Both</h2>
|
| 1355 |
<section class="grid">__TIERS__</section>
|
| 1356 |
-
<h2>Verify the Claims —
|
| 1357 |
-
<section>__VERIFY__<p class="
|
| 1358 |
<footer>
|
| 1359 |
<p class="lock">Doctrine __DV__ LOCKED · locked-proven=__LC__ {__LP__} · __CORPUS__ @ __KC__ · Λ = Conjecture 1 (NOT a theorem) · __SLSA__</p>
|
| 1360 |
<p>SAMPLE = honest synthetic fixture (not live) · MODELED = labeled model output (uncalibrated) · ROADMAP = wiring ready, not measured yet (never faked). Cites: Brodetsky (LinkedIn) · Ledoit-Wolf (honey.pdf) · Laloux/Bouchaud/Potters · Gidea-Katz arXiv:1703.04385 · RAPIDS/cuML · giotto-tda · Ripser++ arXiv:2003.07989.</p>
|
|
@@ -1370,8 +983,7 @@ def _html(pipe: dict, tiers: dict, verify: dict) -> str:
|
|
| 1370 |
title: (label === "SAMPLE") ? "Honest synthetic fixture — not a live feed, no backtest." :
|
| 1371 |
(label === "MODELED") ? "Labeled model output — uncalibrated, not measured." :
|
| 1372 |
(label === "LIVE") ? "Real backend wired and live." :
|
| 1373 |
-
|
| 1374 |
-
"Capability state reported by the live surface."});
|
| 1375 |
}
|
| 1376 |
return '<span>' + label + '</span>';
|
| 1377 |
}
|
|
@@ -1381,15 +993,13 @@ def _html(pipe: dict, tiers: dict, verify: dict) -> str:
|
|
| 1381 |
})();
|
| 1382 |
</script>
|
| 1383 |
</body></html>""" \
|
| 1384 |
-
.replace("__SUMMARY__", "
|
| 1385 |
.replace("__BACKEND__", str(backend["backend"])) \
|
| 1386 |
.replace("__REACH__", str(backend["gpu_reachable"])) \
|
| 1387 |
.replace("__SCEN__", str(pipe["scenario"])) \
|
| 1388 |
-
.replace("__PIPE_SIG__", pipeline_signature_state) \
|
| 1389 |
.replace("__CARDS__", cards) \
|
| 1390 |
.replace("__TIERS__", tier_cards) \
|
| 1391 |
.replace("__VERIFY__", verify_tbl) \
|
| 1392 |
-
.replace("__VRECEIPT__", receipt_line) \
|
| 1393 |
.replace("__VNOTE__", verify["honesty"]) \
|
| 1394 |
.replace("__DV__", d["version"]) \
|
| 1395 |
.replace("__LC__", str(d["locked_count"])) \
|
|
@@ -1489,11 +1099,10 @@ def _selftest() -> dict:
|
|
| 1489 |
assert t["sovereign"] == tp["gpu_reachable"], t
|
| 1490 |
out["tiers_sovereign_honest"] = True
|
| 1491 |
|
| 1492 |
-
# (f) Verify-claims:
|
| 1493 |
vc = verify_claims_panel()
|
| 1494 |
-
|
| 1495 |
-
|
| 1496 |
-
out["verify_claims_receipt_gate"] = True
|
| 1497 |
|
| 1498 |
# (g) HTML renders, non-trivial, no forbidden raw claims.
|
| 1499 |
h = _html(pipe, tp, vc)
|
|
|
|
| 30 |
(cuML LedoitWolf + cuPy eigh + giotto-tda / Ripser++) is labeled ROADMAP. GPU
|
| 31 |
reachability and dependency imports are readiness only; MEASURED requires a distinct
|
| 32 |
accelerated path plus device/kernel/timing execution evidence.
|
| 33 |
+
* Every receipt is SIGNED via szl_dsse.sign_payload (REAL ECDSA when the cosign key
|
| 34 |
+
is present in the runtime; an explicit UNSIGNED honesty marker otherwise — never a
|
| 35 |
+
fabricated signature). The label SAMPLE_SIGNAL | NOT_LIVE | NO_BACKTEST_VALIDATED is
|
| 36 |
+
embedded in the signed payload so the honesty claim is self-verifying.
|
| 37 |
* No fabricated metric. No live-trading claim. No backtest claim. cuML speedups are
|
| 38 |
cited to NVIDIA/STAC docs, never asserted as SZL-measured.
|
| 39 |
|
|
|
|
| 41 |
GET /api/{ns}/v1/quant/pca — Layer 1 PCA-Risk (LW + MP) on a SAMPLE universe
|
| 42 |
GET /api/{ns}/v1/quant/tda — Layer 2 TDA fracture score f_t, z_t, Betti β0/β1
|
| 43 |
GET /api/{ns}/v1/quant/kelly — Layer 3 HJB-Kelly weights w* with σ²_eff
|
| 44 |
+
GET /api/{ns}/v1/quant/pipeline — full 3-layer pass + ONE signed SAMPLE receipt
|
| 45 |
GET /api/{ns}/v1/quant/tiers — 2-GPU serve tier panel (TP=2 / role-split / NIM cloud)
|
| 46 |
GET /api/{ns}/v1/quant/verify-claims — NVIDIA datasheet vs SZL-MEASURED (honest, empty/ROADMAP)
|
| 47 |
GET /quant — unified mobile-first "Quant Engine" tab (0 CDN)
|
|
|
|
| 50 |
"""
|
| 51 |
from __future__ import annotations
|
| 52 |
|
|
|
|
| 53 |
import hashlib as _hashlib
|
| 54 |
import json as _json
|
| 55 |
import math as _math
|
| 56 |
import os as _os
|
|
|
|
| 57 |
import random as _random
|
| 58 |
import time as _time
|
| 59 |
from datetime import datetime, timezone
|
|
|
|
| 61 |
# --- signed receipts: the SINGLE source of truth (never fabricate a signature) ----
|
| 62 |
try:
|
| 63 |
from szl_dsse import sign_payload as _sign_payload # REAL ECDSA when key present
|
|
|
|
| 64 |
_SIGN_AVAILABLE = True
|
| 65 |
except Exception: # pragma: no cover — defensive; honest unsigned fallback below
|
| 66 |
_SIGN_AVAILABLE = False
|
|
|
|
| 79 |
"no signature fabricated."),
|
| 80 |
}
|
| 81 |
|
|
|
|
|
|
|
|
|
|
| 82 |
_QUANT_PAYLOAD_TYPE = "application/vnd.szl.quant.receipt+json"
|
| 83 |
|
| 84 |
# --- optional acceleration probes (honest GPU-path labels) ------------------------
|
|
|
|
| 664 |
|
| 665 |
|
| 666 |
# =====================================================================================
|
| 667 |
+
# FULL PIPELINE -> ONE signed SAMPLE receipt.
|
| 668 |
# =====================================================================================
|
| 669 |
def run_pipeline(stress=False, gamma=0.5, kappa=1.0) -> dict:
|
| 670 |
+
"""Full 3-layer pass + a single SIGNED SAMPLE receipt (DSSE over canonical JSON)."""
|
| 671 |
returns = _sample_returns(stress=stress)
|
| 672 |
l1 = layer1_pca_risk(returns=returns, stress=stress)
|
| 673 |
l2 = layer2_tda_fracture(returns=returns, stress=stress)
|
|
|
|
| 815 |
# =====================================================================================
|
| 816 |
# VERIFY-THE-CLAIMS panel: NVIDIA datasheet vs SZL-MEASURED (honest; empty/ROADMAP).
|
| 817 |
# =====================================================================================
|
| 818 |
+
def verify_claims_panel() -> dict:
|
| 819 |
"""Side-by-side NVIDIA datasheet numbers vs SZL-MEASURED (signed). Honest: SZL columns
|
| 820 |
are empty/ROADMAP until we actually measure on OUR harness. NEVER print the datasheet
|
| 821 |
number as if it were ours."""
|
|
|
|
| 855 |
}
|
| 856 |
|
| 857 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 858 |
# =====================================================================================
|
| 859 |
# Unified "Quant Engine" HTML tab (0 CDN; window.SZLLabels).
|
| 860 |
# =====================================================================================
|
|
|
|
| 890 |
+ row("de-risk ratio", fmt(l3["derisk_ratio_vs_uninflated"]))
|
| 891 |
+ row("γ, κ", "%s, %s <small>(uncalibrated)</small>" % (l3["gamma"], l3["kappa"])))
|
| 892 |
dsse = pipe["signed_receipt"]["dsse"]
|
| 893 |
+
signed = dsse.get("signed", False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 894 |
rc_body = (row("data source", "SAMPLE_SYNTHETIC")
|
| 895 |
+ row("pipeline", "<code>szl-gpu-quant-v0.1</code>")
|
| 896 |
+
+ row("DSSE signed", fmt(signed))
|
| 897 |
+ row("PAE sha256", "<code>%s…</code>" % str(dsse.get("_pae_sha256", ""))[:16])
|
| 898 |
+ row("label", "<small>%s</small>" % SAMPLE_LABEL))
|
| 899 |
|
|
|
|
| 911 |
|
| 912 |
vrows = ""
|
| 913 |
for r in verify["rows"]:
|
| 914 |
+
vrows += ('<tr><td>%s</td><td class="ds">%s</td><td class="ms"><span class="pill-slot" '
|
| 915 |
+
'data-label="%s"></span> %s</td></tr>' % (
|
| 916 |
+
r["claim"], r["nvidia_datasheet"], r["szl_label"], fmt(r["szl_measured"])))
|
| 917 |
+
verify_tbl = ('<table class="vt"><thead><tr><th>Claim</th><th>NVIDIA datasheet</th>'
|
| 918 |
+
'<th>SZL-MEASURED (signed)</th></tr></thead><tbody>%s</tbody></table>' % vrows)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 919 |
|
| 920 |
cards = "".join([
|
| 921 |
card("Layer 1 · PCA Risk (LW + MP)", l1["label"].split(" | ")[0].replace("_SIGNAL", ""), l1_body, l1["honest_note"]),
|
| 922 |
card("Layer 2 · TDA Fracture (β0/β1)", "SAMPLE", l2_body, l2["honest_note"]),
|
| 923 |
card("Layer 3 · HJB-Kelly Sizing", "MODELED", l3_body, l3["honest_note"]),
|
| 924 |
+
card("Signed SAMPLE Receipt", "SAMPLE", rc_body,
|
| 925 |
+
("DSSE envelope over the canonical receipt — REAL ECDSA when the cosign key is in the "
|
| 926 |
+
"runtime, else an explicit UNSIGNED honesty marker (never a fabricated signature).")),
|
| 927 |
])
|
| 928 |
|
| 929 |
return """<!doctype html>
|
|
|
|
| 959 |
<header>
|
| 960 |
<h1>Sovereign Quant Engine</h1>
|
| 961 |
<p class="summary">__SUMMARY__</p>
|
| 962 |
+
<p class="sub">Three orthogonal risk signals per bar — PCA-Risk · TDA-Fracture · HJB-Kelly — each a SIGNED receipt, honestly labeled <b>SAMPLE_SIGNAL · NOT_LIVE · NO_BACKTEST_VALIDATED</b>. Not a trading instruction.</p>
|
| 963 |
<p class="state">backend=__BACKEND__ · gpu_reachable=__REACH__ · scenario=__SCEN__</p>
|
| 964 |
</header>
|
| 965 |
+
<h2>3-Layer Pipeline (signed SAMPLE receipt)</h2>
|
| 966 |
<section class="grid">__CARDS__</section>
|
| 967 |
<h2>2-GPU Sovereign Serve · Throttle Both</h2>
|
| 968 |
<section class="grid">__TIERS__</section>
|
| 969 |
+
<h2>Verify the Claims — NVIDIA datasheet vs SZL-MEASURED (signed)</h2>
|
| 970 |
+
<section>__VERIFY__<p class="note">__VNOTE__</p></section>
|
| 971 |
<footer>
|
| 972 |
<p class="lock">Doctrine __DV__ LOCKED · locked-proven=__LC__ {__LP__} · __CORPUS__ @ __KC__ · Λ = Conjecture 1 (NOT a theorem) · __SLSA__</p>
|
| 973 |
<p>SAMPLE = honest synthetic fixture (not live) · MODELED = labeled model output (uncalibrated) · ROADMAP = wiring ready, not measured yet (never faked). Cites: Brodetsky (LinkedIn) · Ledoit-Wolf (honey.pdf) · Laloux/Bouchaud/Potters · Gidea-Katz arXiv:1703.04385 · RAPIDS/cuML · giotto-tda · Ripser++ arXiv:2003.07989.</p>
|
|
|
|
| 983 |
title: (label === "SAMPLE") ? "Honest synthetic fixture — not a live feed, no backtest." :
|
| 984 |
(label === "MODELED") ? "Labeled model output — uncalibrated, not measured." :
|
| 985 |
(label === "LIVE") ? "Real backend wired and live." :
|
| 986 |
+
"Wiring ready; not measured yet. ROADMAP, never faked."});
|
|
|
|
| 987 |
}
|
| 988 |
return '<span>' + label + '</span>';
|
| 989 |
}
|
|
|
|
| 993 |
})();
|
| 994 |
</script>
|
| 995 |
</body></html>""" \
|
| 996 |
+
.replace("__SUMMARY__", "VRAM-resident quant pipeline (honest CPU fallback today; GPU path ROADMAP)") \
|
| 997 |
.replace("__BACKEND__", str(backend["backend"])) \
|
| 998 |
.replace("__REACH__", str(backend["gpu_reachable"])) \
|
| 999 |
.replace("__SCEN__", str(pipe["scenario"])) \
|
|
|
|
| 1000 |
.replace("__CARDS__", cards) \
|
| 1001 |
.replace("__TIERS__", tier_cards) \
|
| 1002 |
.replace("__VERIFY__", verify_tbl) \
|
|
|
|
| 1003 |
.replace("__VNOTE__", verify["honesty"]) \
|
| 1004 |
.replace("__DV__", d["version"]) \
|
| 1005 |
.replace("__LC__", str(d["locked_count"])) \
|
|
|
|
| 1099 |
assert t["sovereign"] == tp["gpu_reachable"], t
|
| 1100 |
out["tiers_sovereign_honest"] = True
|
| 1101 |
|
| 1102 |
+
# (f) Verify-claims: SZL-MEASURED column is empty/ROADMAP (never the datasheet number).
|
| 1103 |
vc = verify_claims_panel()
|
| 1104 |
+
assert all(r["szl_measured"] is None and r["szl_label"] == "ROADMAP" for r in vc["rows"]), vc
|
| 1105 |
+
out["verify_claims_roadmap"] = True
|
|
|
|
| 1106 |
|
| 1107 |
# (g) HTML renders, non-trivial, no forbidden raw claims.
|
| 1108 |
h = _html(pipe, tp, vc)
|
web/immune.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
<meta charset="UTF-8"/>
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
| 6 |
<title>Immune (Hukulla) — fail-closed egress gate · SZL Holdings</title>
|
| 7 |
-
<meta name="description" content="
|
| 8 |
<!-- 0 runtime CDN (doctrine v11): system fonts only — no Google Fonts, no external assets. -->
|
| 9 |
<style>
|
| 10 |
:root{
|
|
@@ -26,9 +26,7 @@ a{color:inherit;text-decoration:none;}
|
|
| 26 |
.topbar{position:sticky;top:0;z-index:60;display:flex;align-items:center;gap:1rem;flex-wrap:wrap;padding:.5rem 1.1rem;background:rgba(10,10,10,.92);backdrop-filter:blur(10px);border-bottom:1px solid var(--gold-line);font-family:var(--mono);font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--gold);}
|
| 27 |
.topbar .sep{color:var(--dim);}
|
| 28 |
.topbar .live{display:inline-flex;align-items:center;gap:.4rem;color:var(--cream);}
|
| 29 |
-
.live-dot{width:6px;height:6px;border-radius:50%;background:var(--
|
| 30 |
-
.live-dot.ready{background:var(--live);box-shadow:0 0 6px var(--live);}
|
| 31 |
-
.live-dot.error{background:var(--err);box-shadow:0 0 6px var(--err);animation:none;}
|
| 32 |
@keyframes pulse{0%,100%{opacity:1;}50%{opacity:.35;}}
|
| 33 |
.switcher{margin-left:auto;display:flex;align-items:center;gap:.3rem;}
|
| 34 |
.flag{padding:.22rem .55rem;border-radius:6px;border:1px solid transparent;color:var(--muted);transition:.15s;}
|
|
@@ -39,13 +37,12 @@ h1{font-size:1.7rem;font-weight:600;margin:.2rem 0 .3rem;letter-spacing:-.01em;}
|
|
| 39 |
.badge{display:inline-block;font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--teal);border:1px solid var(--teal-line);background:var(--teal-soft);padding:.25rem .6rem;border-radius:5px;margin-left:.4rem;vertical-align:middle;}
|
| 40 |
.lede{color:var(--paragraph);font-size:.95rem;line-height:1.65;max-width:1180px;margin:.6rem 0 1rem;}
|
| 41 |
.lede b{color:var(--cream);font-weight:600;}
|
| 42 |
-
.cards{display:grid;grid-template-columns:repeat(
|
| 43 |
.card{border:1px solid var(--gold-line);background:var(--panel);border-radius:8px;padding:.85rem 1rem;}
|
| 44 |
.card .lbl{font-family:var(--mono);font-size:9.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--dim);}
|
| 45 |
.card .big{font-size:1.5rem;font-weight:600;margin:.35rem 0 .15rem;color:var(--teal);}
|
| 46 |
.card .sub{font-family:var(--mono);font-size:10.5px;color:var(--muted);}
|
| 47 |
-
.grid2{display:grid;grid-template-columns:
|
| 48 |
-
.grid2>*{min-width:0;}
|
| 49 |
.panel{border:1px solid var(--gold-line);background:var(--panel);border-radius:10px;padding:1rem 1.1rem;margin-bottom:1rem;}
|
| 50 |
.panel h2{font-size:1.05rem;font-weight:600;margin:0 0 .2rem;display:flex;align-items:center;justify-content:space-between;}
|
| 51 |
.panel h2 .meta{font-family:var(--mono);font-size:10px;color:var(--dim);text-transform:uppercase;letter-spacing:.06em;}
|
|
@@ -59,8 +56,6 @@ h1{font-size:1.7rem;font-weight:600;margin:.2rem 0 .3rem;letter-spacing:-.01em;}
|
|
| 59 |
.pill.dim{color:var(--muted);}
|
| 60 |
.simnote{border:1px solid var(--warn);background:rgba(201,160,95,.06);border-radius:8px;padding:.7rem .9rem;margin-top:.8rem;font-family:var(--mono);font-size:11px;color:#d8c39a;line-height:1.65;}
|
| 61 |
table{width:100%;border-collapse:collapse;font-family:var(--mono);font-size:11.5px;margin-top:.5rem;}
|
| 62 |
-
.table-scroll{max-width:100%;overflow-x:auto;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch;}
|
| 63 |
-
.table-scroll table{min-width:680px;}
|
| 64 |
th,td{text-align:left;padding:.34rem .5rem;border-bottom:1px solid var(--gold-soft);color:var(--paragraph);vertical-align:top;}
|
| 65 |
th{color:var(--dim);text-transform:uppercase;letter-spacing:.06em;font-size:9.5px;}
|
| 66 |
td.deny{color:var(--red);}td.allow{color:var(--green);}
|
|
@@ -68,7 +63,6 @@ textarea,input{width:100%;background:var(--panel2);border:1px solid var(--gold-l
|
|
| 68 |
textarea:focus,input:focus{outline:none;border-color:var(--teal-line);}
|
| 69 |
button.run{margin-top:.6rem;padding:.55rem 1.1rem;border-radius:7px;border:1px solid var(--teal-line);background:var(--teal-soft);color:var(--teal);font-family:var(--mono);font-size:12px;letter-spacing:.06em;text-transform:uppercase;cursor:pointer;transition:.15s;}
|
| 70 |
button.run:hover{background:rgba(95,179,163,.18);color:var(--cream);}
|
| 71 |
-
button.run:focus-visible,.preset:focus-visible,.flag:focus-visible{outline:2px solid var(--teal);outline-offset:2px;}
|
| 72 |
.preset{display:inline-block;margin:.3rem .3rem 0 0;padding:.2rem .5rem;border-radius:5px;border:1px solid var(--gold-line);color:var(--muted);font-family:var(--mono);font-size:10.5px;cursor:pointer;}
|
| 73 |
.preset:hover{color:var(--cream);border-color:var(--teal-line);}
|
| 74 |
.verdict-box{margin-top:.8rem;border:1px solid var(--gold-line);border-radius:8px;padding:.85rem 1rem;background:var(--panel2);font-family:var(--mono);font-size:12px;line-height:1.8;}
|
|
@@ -78,33 +72,12 @@ button.run:focus-visible,.preset:focus-visible,.flag:focus-visible{outline:2px s
|
|
| 78 |
.digest{color:var(--gold);word-break:break-all;}
|
| 79 |
code{font-family:var(--mono);color:var(--teal);}
|
| 80 |
.footnote{font-family:var(--mono);font-size:10px;color:var(--dim);margin-top:1.6rem;line-height:1.7;}
|
| 81 |
-
@media(max-width:760px){
|
| 82 |
-
.topbar{position:static;padding:.55rem .8rem;gap:.55rem;}
|
| 83 |
-
.switcher{order:3;width:100%;margin-left:0;flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-inline:contain;padding-bottom:.15rem;}
|
| 84 |
-
.flag{flex:0 0 auto;min-height:44px;display:inline-flex;align-items:center;}
|
| 85 |
-
.wrap{padding:1.15rem .85rem 3rem;}
|
| 86 |
-
h1{font-size:1.4rem;line-height:1.25;}
|
| 87 |
-
.badge{display:block;width:max-content;max-width:100%;margin:.55rem 0 0;white-space:normal;}
|
| 88 |
-
.grid2{grid-template-columns:minmax(0,1fr);}
|
| 89 |
-
.panel{padding:.85rem;}
|
| 90 |
-
.panel h2{align-items:flex-start;gap:.5rem;flex-direction:column;}
|
| 91 |
-
.kv .k{min-width:130px;}
|
| 92 |
-
button.run{min-height:44px;width:100%;}
|
| 93 |
-
.preset{min-height:44px;display:inline-flex;align-items:center;}
|
| 94 |
-
}
|
| 95 |
-
@media(max-width:420px){
|
| 96 |
-
.cards{grid-template-columns:minmax(0,1fr);}
|
| 97 |
-
.kv>div{display:grid;grid-template-columns:minmax(0,.7fr) minmax(0,1.3fr);gap:.5rem;}
|
| 98 |
-
.kv .k{min-width:0;}
|
| 99 |
-
.kv .v,.digest{overflow-wrap:anywhere;word-break:break-word;}
|
| 100 |
-
}
|
| 101 |
-
@media(prefers-reduced-motion:reduce){.live-dot{animation:none;}}
|
| 102 |
</style>
|
| 103 |
</head>
|
| 104 |
<body>
|
| 105 |
<div class="topbar">
|
| 106 |
<span>SZL HOLDINGS</span><span class="sep">/</span><span>a11oy</span>
|
| 107 |
-
<span class="live"><span class="live-dot"
|
| 108 |
<span class="switcher">
|
| 109 |
<a class="flag active" href="/immune">Immune</a>
|
| 110 |
<a class="flag" href="/energy">Energy</a>
|
|
@@ -115,13 +88,12 @@ code{font-family:var(--mono);color:var(--teal);}
|
|
| 115 |
</div>
|
| 116 |
|
| 117 |
<div class="wrap">
|
| 118 |
-
<h1>Immune (Hukulla) — fail-closed egress gate<span class="badge" id="organBadge">deny-by-default ·
|
| 119 |
<p class="lede">
|
| 120 |
The <b>Immune</b> organ (Quechua role <b>Hukulla</b>) is a <b>fail-closed, deny-by-default</b> egress gate.
|
| 121 |
-
|
| 122 |
-
<b>Λ-gate</b>
|
| 123 |
-
|
| 124 |
-
No receipt or signature state is inferred by this page. Proven Lean backing:
|
| 125 |
<code>ImmuneNeymanPearsonOpt.lean</code> (Neyman–Pearson-optimal egress) and
|
| 126 |
<code>FrontierWelfordVariance.lean</code> (Welford online variance). These back the gate but are
|
| 127 |
<b>not</b> folded into the locked-8 proven set. Λ = <b>Conjecture 1</b> (not a theorem);
|
|
@@ -139,7 +111,7 @@ code{font-family:var(--mono);color:var(--teal);}
|
|
| 139 |
<div class="panel">
|
| 140 |
<h2>Inspect an action <span class="meta" id="verdictEp">POST /api/a11oy/v1/immune/verdict</span></h2>
|
| 141 |
<p class="lede" style="margin:.2rem 0 .6rem;font-size:.86rem;">
|
| 142 |
-
Submit
|
| 143 |
Optionally include <code>axes</code> (a JSON array of trust scores) to exercise the Λ-gate floor.
|
| 144 |
</p>
|
| 145 |
<div>
|
|
@@ -157,7 +129,7 @@ code{font-family:var(--mono);color:var(--teal);}
|
|
| 157 |
|
| 158 |
<div class="panel">
|
| 159 |
<h2>Live status <span class="meta" id="statusEp">GET /api/a11oy/v1/immune/status</span></h2>
|
| 160 |
-
<div class="kv" id="statusKv"
|
| 161 |
<div class="simnote" id="honestyNote">
|
| 162 |
Λ = Conjecture 1 (NOT a theorem). Khipu = Conjecture 2. Trust never 100%. Effectors simulated.
|
| 163 |
Decision feed is in-memory (resets on restart) — empty means IDLE, never faked.
|
|
@@ -167,12 +139,12 @@ code{font-family:var(--mono);color:var(--teal);}
|
|
| 167 |
|
| 168 |
<div class="panel">
|
| 169 |
<h2>Gates <span class="meta" id="gatesEp">GET /api/a11oy/v1/immune/gates</span></h2>
|
| 170 |
-
<
|
| 171 |
</div>
|
| 172 |
|
| 173 |
<div class="panel">
|
| 174 |
<h2>Decision feed <span class="meta" id="feedEp">GET /api/a11oy/v1/immune/feed</span></h2>
|
| 175 |
-
<
|
| 176 |
</div>
|
| 177 |
|
| 178 |
<div class="footnote" id="leanFoot">
|
|
@@ -184,96 +156,45 @@ code{font-family:var(--mono);color:var(--teal);}
|
|
| 184 |
|
| 185 |
<script>
|
| 186 |
const BASE = "/api/a11oy/v1/immune";
|
| 187 |
-
async function
|
| 188 |
-
try{
|
| 189 |
-
const r=await fetch(u,opt);
|
| 190 |
-
const text=await r.text();
|
| 191 |
-
let data=null;
|
| 192 |
-
if(text){
|
| 193 |
-
try{data=JSON.parse(text);}
|
| 194 |
-
catch(e){return {ok:false,status:r.status,error:"invalid JSON response",data:null};}
|
| 195 |
-
}
|
| 196 |
-
if(!r.ok){
|
| 197 |
-
const detail=data&&(data.detail||data.error||data.message);
|
| 198 |
-
return {ok:false,status:r.status,error:detail||("HTTP "+r.status),data:data};
|
| 199 |
-
}
|
| 200 |
-
return {ok:true,status:r.status,error:null,data:data};
|
| 201 |
-
}catch(e){
|
| 202 |
-
return {ok:false,status:null,error:(e&&e.message)||String(e),data:null};
|
| 203 |
-
}
|
| 204 |
-
}
|
| 205 |
function esc(s){return String(s).replace(/[&<>"']/g,function(c){return({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]||c);});}
|
| 206 |
-
function evidenceValue(v){
|
| 207 |
-
if(typeof v==="string")return v;
|
| 208 |
-
try{return JSON.stringify(v);}catch(e){return String(v);}
|
| 209 |
-
}
|
| 210 |
-
function present(v){return v!==undefined&&v!==null&&v!=="";}
|
| 211 |
-
function row(label,value,cls){
|
| 212 |
-
if(!present(value))return "";
|
| 213 |
-
return '<div><span class="k">'+esc(label)+'</span><span class="v '+(cls||'')+'">'+esc(evidenceValue(value))+'</span></div>';
|
| 214 |
-
}
|
| 215 |
-
function connectionState(state,reachable){
|
| 216 |
-
const normalized=present(state)?String(state).trim().toUpperCase():"UNKNOWN";
|
| 217 |
-
const ready=reachable&&["LIVE","REAL","READY","OPERATIONAL","MEASURED"].includes(normalized);
|
| 218 |
-
const dot=document.getElementById("liveDot");
|
| 219 |
-
dot.className="live-dot"+(ready?" ready":reachable?"":" error");
|
| 220 |
-
document.getElementById("liveTag").textContent="IMMUNE · "+(reachable?normalized:"UNAVAILABLE");
|
| 221 |
-
document.getElementById("organBadge").textContent=ready?"deny-by-default · backend reported "+normalized.toLowerCase():"deny-by-default · evidence "+(reachable?normalized.toLowerCase():"unavailable");
|
| 222 |
-
return {normalized,ready};
|
| 223 |
-
}
|
| 224 |
-
function requestFailure(result){
|
| 225 |
-
const status=result.status==null?"network error":"HTTP "+result.status;
|
| 226 |
-
return status+(present(result.error)?" · "+result.error:result.ok?" · required evidence unavailable":"");
|
| 227 |
-
}
|
| 228 |
|
| 229 |
async function loadStatus(){
|
| 230 |
-
const
|
| 231 |
const kv = document.getElementById("statusKv");
|
| 232 |
-
if(!
|
| 233 |
-
|
| 234 |
-
kv.innerHTML=row("status","UNAVAILABLE")+row("evidence",requestFailure(result));
|
| 235 |
-
return;
|
| 236 |
-
}
|
| 237 |
-
const s=result.data;
|
| 238 |
-
const state=connectionState(s.status,true);
|
| 239 |
-
document.getElementById("cVerdicts").textContent = (s.verdicts_this_process ?? "—");
|
| 240 |
document.getElementById("cDenyRate").textContent = (s.deny_rate==null?"—":(Math.round(s.deny_rate*1000)/10)+"%");
|
| 241 |
-
document.getElementById("cDenySub").textContent = (s.deny ??
|
| 242 |
document.getElementById("cCorpus").textContent = (s.signature_corpus_size ?? "—");
|
| 243 |
-
document.getElementById("cCorpusSub").textContent = (s.threats_corpus_total ??
|
| 244 |
const k = s.khipu||{};
|
| 245 |
document.getElementById("cChain").textContent = (k.chain_depth ?? "—");
|
| 246 |
-
document.getElementById("cChainSub").textContent = (
|
| 247 |
-
const observed=s.observed_at||s.observedAt||s.timestamp;
|
| 248 |
kv.innerHTML =
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
row("observed at",observed)+
|
| 258 |
-
'<div><span class="k">status</span><span class="pill '+(state.ready?'green':'yellow')+'">'+esc(state.normalized)+'</span></div>';
|
| 259 |
}
|
| 260 |
|
| 261 |
async function loadGates(){
|
| 262 |
-
const
|
| 263 |
const tb = document.querySelector("#gatesTable tbody");
|
| 264 |
-
if(!
|
| 265 |
-
const g=result.data;
|
| 266 |
tb.innerHTML = g.gates.map(x=>
|
| 267 |
'<tr><td class="mono">'+esc(x.id)+'</td><td>'+esc(x.name)+'</td><td>'+esc(x.label)+'</td><td>'+esc(x.category)+'</td>'+
|
| 268 |
'<td><code>'+esc(String(x.sampleInput).slice(0,46))+'</code> → <b>'+esc(x.expectedDecision)+'</b></td></tr>').join("");
|
| 269 |
}
|
| 270 |
|
| 271 |
async function loadFeed(){
|
| 272 |
-
const
|
| 273 |
const tb = document.querySelector("#feedTable tbody");
|
| 274 |
-
if(!
|
| 275 |
-
const f=result.data;
|
| 276 |
-
if(!f.verdicts.length){tb.innerHTML='<tr><td class="mono" colspan="5">IDLE — no verdicts buffered (resets on restart)</td></tr>';return;}
|
| 277 |
tb.innerHTML = f.verdicts.map(v=>
|
| 278 |
'<tr><td>'+esc((v.timestamp||"").slice(11,19))+'</td>'+
|
| 279 |
'<td class="'+esc(v.decision)+'">'+esc(v.decision)+'</td>'+
|
|
@@ -288,33 +209,21 @@ async function runVerdict(){
|
|
| 288 |
try{ body = JSON.parse(document.getElementById("actionInput").value); }
|
| 289 |
catch(e){ out.innerHTML='<div class="verdict-box deny">Invalid JSON: '+esc(e.message)+'</div>'; return; }
|
| 290 |
out.innerHTML='<div class="verdict-box">inspecting…</div>';
|
| 291 |
-
const
|
| 292 |
-
if(!
|
| 293 |
-
const
|
| 294 |
-
const
|
| 295 |
-
const
|
| 296 |
-
const pill = decision==="deny"?'<span class="pill red">DENY</span>':decision==="allow"?'<span class="pill green">ALLOW</span>':'<span class="pill yellow">UNKNOWN</span>';
|
| 297 |
-
const sigs = Array.isArray(v.signals)?(v.signals.map(s=>'<span class="sig">'+esc(s)+'</span>').join("")||'<span class="pill dim">no signals returned</span>'):'<span class="pill dim">signals unavailable</span>';
|
| 298 |
const rec = v.khipu_receipt||{};
|
| 299 |
-
const observed=v.observed_at||v.observedAt||v.timestamp||rec.observed_at||rec.timestamp;
|
| 300 |
-
const lambdaEvidence=present(v.lambda_value)?' <span style="color:var(--dim)">Λ='+esc(v.lambda_value)+(present(v.lambda_floor)?' (floor '+esc(v.lambda_floor)+')':'')+'</span>':'';
|
| 301 |
-
const reasonEvidence=present(v.reason)?'<div style="margin:.4rem 0;color:var(--paragraph)">'+esc(v.reason)+'</div>':'';
|
| 302 |
-
const policyEvidence=row("fail closed",v.fail_closed)+row("doctrine",v.doctrine);
|
| 303 |
-
const receiptEvidence=
|
| 304 |
-
row("verdict hash",v.receipt_hash,"digest")+
|
| 305 |
-
row("receipt digest",rec.digest,"digest")+
|
| 306 |
-
row("receipt sequence",rec.seq)+
|
| 307 |
-
row("receipt type",rec.receipt_type)+
|
| 308 |
-
row("signature",rec.signature,"digest")+
|
| 309 |
-
row("chain verified",typeof rec.chain_verified==="boolean"?String(rec.chain_verified):null)+
|
| 310 |
-
row("traceparent",v.traceparent,"digest")+
|
| 311 |
-
row("observed at",observed);
|
| 312 |
out.innerHTML =
|
| 313 |
'<div class="verdict-box '+cls+'">'+
|
| 314 |
-
'<div>decision '+pill+
|
| 315 |
-
|
| 316 |
'<div style="margin:.3rem 0;">signals: '+sigs+'</div>'+
|
| 317 |
-
'<div class="
|
|
|
|
|
|
|
|
|
|
| 318 |
'</div>';
|
| 319 |
loadStatus(); loadFeed();
|
| 320 |
}
|
|
|
|
| 4 |
<meta charset="UTF-8"/>
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
| 6 |
<title>Immune (Hukulla) — fail-closed egress gate · SZL Holdings</title>
|
| 7 |
+
<meta name="description" content="Live, honest view of the Immune organ (Quechua role 'Hukulla') — a fail-closed, deny-by-default egress gate. Real threat-signature scan + 1 MB size guard + Lambda-gate floor, every verdict signed into the shared Khipu chain. Lean backing: ImmuneNeymanPearsonOpt + FrontierWelfordVariance. Lambda = Conjecture 1; Khipu = Conjecture 2; trust never 100%."/>
|
| 8 |
<!-- 0 runtime CDN (doctrine v11): system fonts only — no Google Fonts, no external assets. -->
|
| 9 |
<style>
|
| 10 |
:root{
|
|
|
|
| 26 |
.topbar{position:sticky;top:0;z-index:60;display:flex;align-items:center;gap:1rem;flex-wrap:wrap;padding:.5rem 1.1rem;background:rgba(10,10,10,.92);backdrop-filter:blur(10px);border-bottom:1px solid var(--gold-line);font-family:var(--mono);font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--gold);}
|
| 27 |
.topbar .sep{color:var(--dim);}
|
| 28 |
.topbar .live{display:inline-flex;align-items:center;gap:.4rem;color:var(--cream);}
|
| 29 |
+
.live-dot{width:6px;height:6px;border-radius:50%;background:var(--live);box-shadow:0 0 6px var(--live);animation:pulse 2.2s ease-in-out infinite;}
|
|
|
|
|
|
|
| 30 |
@keyframes pulse{0%,100%{opacity:1;}50%{opacity:.35;}}
|
| 31 |
.switcher{margin-left:auto;display:flex;align-items:center;gap:.3rem;}
|
| 32 |
.flag{padding:.22rem .55rem;border-radius:6px;border:1px solid transparent;color:var(--muted);transition:.15s;}
|
|
|
|
| 37 |
.badge{display:inline-block;font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--teal);border:1px solid var(--teal-line);background:var(--teal-soft);padding:.25rem .6rem;border-radius:5px;margin-left:.4rem;vertical-align:middle;}
|
| 38 |
.lede{color:var(--paragraph);font-size:.95rem;line-height:1.65;max-width:1180px;margin:.6rem 0 1rem;}
|
| 39 |
.lede b{color:var(--cream);font-weight:600;}
|
| 40 |
+
.cards{display:grid;grid-template-columns:repeat(4,1fr);gap:.8rem;margin:0 0 1.2rem;}
|
| 41 |
.card{border:1px solid var(--gold-line);background:var(--panel);border-radius:8px;padding:.85rem 1rem;}
|
| 42 |
.card .lbl{font-family:var(--mono);font-size:9.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--dim);}
|
| 43 |
.card .big{font-size:1.5rem;font-weight:600;margin:.35rem 0 .15rem;color:var(--teal);}
|
| 44 |
.card .sub{font-family:var(--mono);font-size:10.5px;color:var(--muted);}
|
| 45 |
+
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:1rem;}
|
|
|
|
| 46 |
.panel{border:1px solid var(--gold-line);background:var(--panel);border-radius:10px;padding:1rem 1.1rem;margin-bottom:1rem;}
|
| 47 |
.panel h2{font-size:1.05rem;font-weight:600;margin:0 0 .2rem;display:flex;align-items:center;justify-content:space-between;}
|
| 48 |
.panel h2 .meta{font-family:var(--mono);font-size:10px;color:var(--dim);text-transform:uppercase;letter-spacing:.06em;}
|
|
|
|
| 56 |
.pill.dim{color:var(--muted);}
|
| 57 |
.simnote{border:1px solid var(--warn);background:rgba(201,160,95,.06);border-radius:8px;padding:.7rem .9rem;margin-top:.8rem;font-family:var(--mono);font-size:11px;color:#d8c39a;line-height:1.65;}
|
| 58 |
table{width:100%;border-collapse:collapse;font-family:var(--mono);font-size:11.5px;margin-top:.5rem;}
|
|
|
|
|
|
|
| 59 |
th,td{text-align:left;padding:.34rem .5rem;border-bottom:1px solid var(--gold-soft);color:var(--paragraph);vertical-align:top;}
|
| 60 |
th{color:var(--dim);text-transform:uppercase;letter-spacing:.06em;font-size:9.5px;}
|
| 61 |
td.deny{color:var(--red);}td.allow{color:var(--green);}
|
|
|
|
| 63 |
textarea:focus,input:focus{outline:none;border-color:var(--teal-line);}
|
| 64 |
button.run{margin-top:.6rem;padding:.55rem 1.1rem;border-radius:7px;border:1px solid var(--teal-line);background:var(--teal-soft);color:var(--teal);font-family:var(--mono);font-size:12px;letter-spacing:.06em;text-transform:uppercase;cursor:pointer;transition:.15s;}
|
| 65 |
button.run:hover{background:rgba(95,179,163,.18);color:var(--cream);}
|
|
|
|
| 66 |
.preset{display:inline-block;margin:.3rem .3rem 0 0;padding:.2rem .5rem;border-radius:5px;border:1px solid var(--gold-line);color:var(--muted);font-family:var(--mono);font-size:10.5px;cursor:pointer;}
|
| 67 |
.preset:hover{color:var(--cream);border-color:var(--teal-line);}
|
| 68 |
.verdict-box{margin-top:.8rem;border:1px solid var(--gold-line);border-radius:8px;padding:.85rem 1rem;background:var(--panel2);font-family:var(--mono);font-size:12px;line-height:1.8;}
|
|
|
|
| 72 |
.digest{color:var(--gold);word-break:break-all;}
|
| 73 |
code{font-family:var(--mono);color:var(--teal);}
|
| 74 |
.footnote{font-family:var(--mono);font-size:10px;color:var(--dim);margin-top:1.6rem;line-height:1.7;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
</style>
|
| 76 |
</head>
|
| 77 |
<body>
|
| 78 |
<div class="topbar">
|
| 79 |
<span>SZL HOLDINGS</span><span class="sep">/</span><span>a11oy</span>
|
| 80 |
+
<span class="live"><span class="live-dot"></span><span id="liveTag">IMMUNE · LIVE</span></span>
|
| 81 |
<span class="switcher">
|
| 82 |
<a class="flag active" href="/immune">Immune</a>
|
| 83 |
<a class="flag" href="/energy">Energy</a>
|
|
|
|
| 88 |
</div>
|
| 89 |
|
| 90 |
<div class="wrap">
|
| 91 |
+
<h1>Immune (Hukulla) — fail-closed egress gate<span class="badge" id="organBadge">deny-by-default · real inspection · Khipu-signed</span></h1>
|
| 92 |
<p class="lede">
|
| 93 |
The <b>Immune</b> organ (Quechua role <b>Hukulla</b>) is a <b>fail-closed, deny-by-default</b> egress gate.
|
| 94 |
+
Every action is inspected against a real threat-signature corpus, a 1 MB size guard and a
|
| 95 |
+
<b>Λ-gate floor</b> (MIN of supplied trust axes < 0.5 → deny). Each verdict is signed into the
|
| 96 |
+
<b>shared Khipu chain</b> (<code>SZL.Immune.Verdict.v1</code>). Proven Lean backing:
|
|
|
|
| 97 |
<code>ImmuneNeymanPearsonOpt.lean</code> (Neyman–Pearson-optimal egress) and
|
| 98 |
<code>FrontierWelfordVariance.lean</code> (Welford online variance). These back the gate but are
|
| 99 |
<b>not</b> folded into the locked-8 proven set. Λ = <b>Conjecture 1</b> (not a theorem);
|
|
|
|
| 111 |
<div class="panel">
|
| 112 |
<h2>Inspect an action <span class="meta" id="verdictEp">POST /api/a11oy/v1/immune/verdict</span></h2>
|
| 113 |
<p class="lede" style="margin:.2rem 0 .6rem;font-size:.86rem;">
|
| 114 |
+
Submit a real action payload. The gate runs the live inspection and signs a Khipu receipt.
|
| 115 |
Optionally include <code>axes</code> (a JSON array of trust scores) to exercise the Λ-gate floor.
|
| 116 |
</p>
|
| 117 |
<div>
|
|
|
|
| 129 |
|
| 130 |
<div class="panel">
|
| 131 |
<h2>Live status <span class="meta" id="statusEp">GET /api/a11oy/v1/immune/status</span></h2>
|
| 132 |
+
<div class="kv" id="statusKv"><span class="k">loading…</span></div>
|
| 133 |
<div class="simnote" id="honestyNote">
|
| 134 |
Λ = Conjecture 1 (NOT a theorem). Khipu = Conjecture 2. Trust never 100%. Effectors simulated.
|
| 135 |
Decision feed is in-memory (resets on restart) — empty means IDLE, never faked.
|
|
|
|
| 139 |
|
| 140 |
<div class="panel">
|
| 141 |
<h2>Gates <span class="meta" id="gatesEp">GET /api/a11oy/v1/immune/gates</span></h2>
|
| 142 |
+
<table id="gatesTable"><thead><tr><th>id</th><th>name</th><th>label</th><th>category</th><th>sample → expected</th></tr></thead><tbody><tr><td class="mono" colspan="5">loading…</td></tr></tbody></table>
|
| 143 |
</div>
|
| 144 |
|
| 145 |
<div class="panel">
|
| 146 |
<h2>Decision feed <span class="meta" id="feedEp">GET /api/a11oy/v1/immune/feed</span></h2>
|
| 147 |
+
<table id="feedTable"><thead><tr><th>time</th><th>decision</th><th>signals</th><th>Λ</th><th>receipt</th></tr></thead><tbody><tr><td class="mono" colspan="5">loading…</td></tr></tbody></table>
|
| 148 |
</div>
|
| 149 |
|
| 150 |
<div class="footnote" id="leanFoot">
|
|
|
|
| 156 |
|
| 157 |
<script>
|
| 158 |
const BASE = "/api/a11oy/v1/immune";
|
| 159 |
+
async function getJSON(u,opt){try{const r=await fetch(u,opt);if(!r.ok)return null;return await r.json();}catch(e){return null;}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
function esc(s){return String(s).replace(/[&<>"']/g,function(c){return({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]||c);});}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
|
| 162 |
async function loadStatus(){
|
| 163 |
+
const s = await getJSON(BASE + "/status");
|
| 164 |
const kv = document.getElementById("statusKv");
|
| 165 |
+
if(!s){kv.innerHTML='<span class="k">status</span><span class="v">unreachable — retrying</span>';return;}
|
| 166 |
+
document.getElementById("cVerdicts").textContent = (s.verdicts_this_process ?? 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
document.getElementById("cDenyRate").textContent = (s.deny_rate==null?"—":(Math.round(s.deny_rate*1000)/10)+"%");
|
| 168 |
+
document.getElementById("cDenySub").textContent = (s.deny ?? 0)+" deny / "+(s.allow ?? 0)+" allow";
|
| 169 |
document.getElementById("cCorpus").textContent = (s.signature_corpus_size ?? "—");
|
| 170 |
+
document.getElementById("cCorpusSub").textContent = (s.threats_corpus_total ?? 0)+" STIX/MITRE in corpus";
|
| 171 |
const k = s.khipu||{};
|
| 172 |
document.getElementById("cChain").textContent = (k.chain_depth ?? "—");
|
| 173 |
+
document.getElementById("cChainSub").textContent = (k.chain_verified? "chain verified":"unverified");
|
|
|
|
| 174 |
kv.innerHTML =
|
| 175 |
+
'<div><span class="k">organ</span><span class="v">'+esc(s.organ||"Immune (Hukulla)")+'</span></div>'+
|
| 176 |
+
'<div><span class="k">role</span><span class="v">'+esc(s.role||"")+'</span></div>'+
|
| 177 |
+
'<div><span class="k">Λ-gate floor</span><span class="v">'+esc(s.lambda_gate_floor)+'</span></div>'+
|
| 178 |
+
'<div><span class="k">size guard</span><span class="v">'+esc(s.size_guard_bytes)+' bytes</span></div>'+
|
| 179 |
+
'<div><span class="k">signatures</span><span class="v">'+esc((s.signatures||[]).join(", "))+'</span></div>'+
|
| 180 |
+
'<div><span class="k">last receipt</span><span class="v digest">'+esc(s.last_receipt_digest||"(none yet)")+'</span></div>'+
|
| 181 |
+
'<div><span class="k">khipu head</span><span class="v digest">'+esc((k.head_digest||"").slice(0,32))+'…</span></div>'+
|
| 182 |
+
'<div><span class="k">status</span><span class="pill green">'+esc(s.status||"REAL")+'</span></div>';
|
|
|
|
|
|
|
| 183 |
}
|
| 184 |
|
| 185 |
async function loadGates(){
|
| 186 |
+
const g = await getJSON(BASE + "/gates");
|
| 187 |
const tb = document.querySelector("#gatesTable tbody");
|
| 188 |
+
if(!g || !g.gates){tb.innerHTML='<tr><td class="mono" colspan="5">unreachable</td></tr>';return;}
|
|
|
|
| 189 |
tb.innerHTML = g.gates.map(x=>
|
| 190 |
'<tr><td class="mono">'+esc(x.id)+'</td><td>'+esc(x.name)+'</td><td>'+esc(x.label)+'</td><td>'+esc(x.category)+'</td>'+
|
| 191 |
'<td><code>'+esc(String(x.sampleInput).slice(0,46))+'</code> → <b>'+esc(x.expectedDecision)+'</b></td></tr>').join("");
|
| 192 |
}
|
| 193 |
|
| 194 |
async function loadFeed(){
|
| 195 |
+
const f = await getJSON(BASE + "/feed?limit=20");
|
| 196 |
const tb = document.querySelector("#feedTable tbody");
|
| 197 |
+
if(!f || !f.verdicts || !f.verdicts.length){tb.innerHTML='<tr><td class="mono" colspan="5">IDLE — no verdicts buffered (resets on restart)</td></tr>';return;}
|
|
|
|
|
|
|
| 198 |
tb.innerHTML = f.verdicts.map(v=>
|
| 199 |
'<tr><td>'+esc((v.timestamp||"").slice(11,19))+'</td>'+
|
| 200 |
'<td class="'+esc(v.decision)+'">'+esc(v.decision)+'</td>'+
|
|
|
|
| 209 |
try{ body = JSON.parse(document.getElementById("actionInput").value); }
|
| 210 |
catch(e){ out.innerHTML='<div class="verdict-box deny">Invalid JSON: '+esc(e.message)+'</div>'; return; }
|
| 211 |
out.innerHTML='<div class="verdict-box">inspecting…</div>';
|
| 212 |
+
const v = await getJSON(BASE + "/verdict", {method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(body)});
|
| 213 |
+
if(!v){ out.innerHTML='<div class="verdict-box deny">endpoint unreachable — retry</div>'; return; }
|
| 214 |
+
const cls = v.decision==="deny"?"deny":"allow";
|
| 215 |
+
const pill = v.decision==="deny"?'<span class="pill red">DENY</span>':'<span class="pill green">ALLOW</span>';
|
| 216 |
+
const sigs = (v.signals||[]).map(s=>'<span class="sig">'+esc(s)+'</span>').join("") || '<span class="pill dim">no signal</span>';
|
|
|
|
|
|
|
| 217 |
const rec = v.khipu_receipt||{};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
out.innerHTML =
|
| 219 |
'<div class="verdict-box '+cls+'">'+
|
| 220 |
+
'<div>decision '+pill+' <span style="color:var(--dim)">Λ='+esc(v.lambda_value)+' (floor '+esc(v.lambda_floor)+')</span></div>'+
|
| 221 |
+
'<div style="margin:.4rem 0;color:var(--paragraph)">'+esc(v.reason)+'</div>'+
|
| 222 |
'<div style="margin:.3rem 0;">signals: '+sigs+'</div>'+
|
| 223 |
+
'<div><span style="color:var(--dim)">verdict hash</span> <span class="digest">'+esc(v.receipt_hash)+'</span></div>'+
|
| 224 |
+
'<div><span style="color:var(--dim)">Khipu receipt</span> <span class="digest">'+esc(rec.digest||"")+'</span> '+
|
| 225 |
+
'<span style="color:var(--dim)">seq '+esc(rec.seq)+' · '+esc(rec.receipt_type||"SZL.Immune.Verdict.v1")+'</span></div>'+
|
| 226 |
+
'<div style="color:var(--dim);margin-top:.3rem">fail-closed='+esc(v.fail_closed)+' · doctrine '+esc(v.doctrine)+'</div>'+
|
| 227 |
'</div>';
|
| 228 |
loadStatus(); loadFeed();
|
| 229 |
}
|