betterwithage commited on
Commit
138f8e6
·
verified ·
1 Parent(s): 60ef701

chore(sync): mirror backend .py + Dockerfile to Space (hf-sync-backend)

Browse files

Automated backend sync from szl-holdings/a11oy main via hf-sync-backend.
Updated (differed from the Space): a11oy_grc.py
Deleted (gone from the repo + Dockerfile COPY set): (none)

Keeps the Space-built backend (serve.py + the Dockerfile-COPY'd .py
modules) identical to GitHub main so the Space never rebuilds from a
stale backend, new endpoints don't 404 there, and orphaned modules
removed from the repo don't linger in the Space tree.

Files changed (1) hide show
  1. a11oy_grc.py +107 -0
a11oy_grc.py CHANGED
@@ -172,6 +172,27 @@ def _page_html(ns: str) -> str:
172
  <div class="out" id="raw-oscal">loading…</div></details>
173
  </div>
174
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  <div class="src">Adopted &amp; cited — sources:
176
  <a href="https://www.iso.org/standard/81230.html" target="_blank" rel="noopener">ISO/IEC 42001:2023</a> ·
177
  <a href="https://airc.nist.gov/airmf-resources/airmf/5-sec-core/" target="_blank" rel="noopener">NIST AI RMF 1.0</a> ·
@@ -186,6 +207,92 @@ def _page_html(ns: str) -> str:
186
  <script src="/static/shared/szl_label_engine.js" defer></script>
187
  <script src="/static/shared/szl_receipt_cosign.js" defer></script>
188
  <script src="/static/shared/szl_codename_sanitizer.js" defer></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  <script>
190
  "use strict";
191
  const API="/api/__NS__/v1/grc";
 
172
  <div class="out" id="raw-oscal">loading…</div></details>
173
  </div>
174
 
175
+ <div class="panel" id="grc3d_panel">
176
+ <h2>3D Coverage Matrix — floating OSCAL control grid
177
+ <button id="g3d-toggle" style="float:right;font-size:11px;cursor:pointer;background:#10171f;color:var(--gold);border:1px solid var(--line);border-radius:6px;padding:3px 9px">Enable 3D</button></h2>
178
+ <p class="pp">The SAME live <code>/grc/matrix</code> + <code>/grc/oscal</code> controls rendered on the shared 0-CDN
179
+ holographic kit as a floating control grid: a <b style="color:#39d98a">green sphere</b> = COVERED (a specific
180
+ testable mechanism), <b style="color:#f5c451">amber</b> = PARTIAL, <b style="color:#ff6a5a">red</b> = ROADMAP / gap.
181
+ When a control is backed by a signed DSSE receipt, a <b>signed evidence pulse</b> lights its edge to the framework hub.
182
+ <b>ALIGNS WITH / maps to the frameworks — never certified.</b> CPU/old-GPU renders the same data on a 2D canvas
183
+ fallback; the coverage table above is the complete non-3D experience. Patterns: NIST OSCAL, Credo AI, OneTrust.</p>
184
+ <div class="pp mono" style="display:flex;gap:1.2rem;flex-wrap:wrap;font-size:11px;color:var(--para)">
185
+ <span>COVERED <span id="g3d-cov" style="color:#39d98a">—</span></span>
186
+ <span>PARTIAL <span id="g3d-par" style="color:#f5c451">—</span></span>
187
+ <span>ROADMAP/gap <span id="g3d-gap" style="color:#ff6a5a">—</span></span>
188
+ <span>signed evidence pulses <span id="g3d-pulse" style="color:var(--teal)">0</span></span>
189
+ <span id="g3d-caps" style="color:var(--para)"></span>
190
+ </div>
191
+ <div id="grc3d_mount" style="width:100%;height:440px;border:1px solid var(--line);border-radius:10px;background:#04070b;display:none;position:relative;margin-top:8px"></div>
192
+ <div class="pp" id="g3d-off" style="border:1px dashed var(--line);border-radius:8px;padding:10px;margin-top:8px">3D is off (default). Click <b>Enable 3D</b> to render the holographic OSCAL coverage matrix on the live <code>/grc/matrix</code> + <code>/grc/oscal</code> endpoints. The coverage table above is always available as the fallback.</div>
193
+ <div class="disc" style="margin-top:10px"><b>Honest:</b> spheres reflect a11oy's INTERNAL analysis of its mechanisms against published control text — <b>ALIGNS WITH / MAPS TO</b>, <b>not</b> a certification artifact. Coverage states (COVERED / PARTIAL / ROADMAP / N/A) come straight from the live <code>/grc/matrix</code>; gaps are shown honestly. 0 runtime CDN · WebGL2 + 2D fallback · Λ = Conjecture 1 (&lt;1.0) · trust &lt; 100%.</div>
194
+ </div>
195
+
196
  <div class="src">Adopted &amp; cited — sources:
197
  <a href="https://www.iso.org/standard/81230.html" target="_blank" rel="noopener">ISO/IEC 42001:2023</a> ·
198
  <a href="https://airc.nist.gov/airmf-resources/airmf/5-sec-core/" target="_blank" rel="noopener">NIST AI RMF 1.0</a> ·
 
207
  <script src="/static/shared/szl_label_engine.js" defer></script>
208
  <script src="/static/shared/szl_receipt_cosign.js" defer></script>
209
  <script src="/static/shared/szl_codename_sanitizer.js" defer></script>
210
+
211
+ <script src="/static/shared/szl_holo3d.js"></script>
212
+ <script>
213
+ "use strict";
214
+ (function(){
215
+ var GAPI="/api/__NS__/v1/grc";
216
+ var mount=document.getElementById('grc3d_mount');
217
+ var offEl=document.getElementById('g3d-off');
218
+ var toggle=document.getElementById('g3d-toggle');
219
+ if(!mount||!toggle){ return; }
220
+ if(!window.SZLHolo){ toggle.disabled=true; toggle.textContent='3D unavailable'; return; }
221
+ var scene=null, started=false, anim=null, pulses=0;
222
+ var COV=document.getElementById('g3d-cov'), PAR=document.getElementById('g3d-par'),
223
+ GAP=document.getElementById('g3d-gap'), PUL=document.getElementById('g3d-pulse'),
224
+ CAP=document.getElementById('g3d-caps');
225
+ function getJSON(u){return fetch(u).then(function(r){return r.ok?r.json():null;}).catch(function(){return null;});}
226
+
227
+ function covClass(c){
228
+ var s=String(c||'').toUpperCase();
229
+ if(s.indexOf('COVER')>=0) return 'cov';
230
+ if(s.indexOf('PART')>=0) return 'par';
231
+ if(s.indexOf('N/A')>=0||s.indexOf('NA')===0) return 'na';
232
+ return 'gap'; // ROADMAP / gap / planned
233
+ }
234
+ // map coverage -> a Λ value (Conjecture 1, <1.0) so the trust sphere + node color reads honestly:
235
+ // COVERED low risk (greenish), PARTIAL mid (amber), gap high (red).
236
+ function covLambda(klass){ return klass==='cov'?0.30 : klass==='par'?0.62 : klass==='na'?0.45 : 0.92; }
237
+
238
+ var _rows=[], _signedCtl={};
239
+ function build(){
240
+ if(!scene)return;
241
+ var nodes=[{id:'hub',label:'OSCAL·HUB'}];
242
+ var edges=[]; var ei=0; var counts={cov:0,par:0,gap:0,na:0};
243
+ _rows.forEach(function(r,i){
244
+ var klass=covClass(r.coverage); counts[klass]=(counts[klass]||0)+1;
245
+ var id='c'+i;
246
+ nodes.push({id:id,label:String(r.control||('ctl'+i)).slice(0,9),lambda:covLambda(klass)});
247
+ edges.push({id:'g'+(ei++),from:'hub',to:id});
248
+ });
249
+ try{
250
+ scene.graphs=[]; scene.pulses=[]; scene.spheres=[];
251
+ scene.addGraph({nodes:nodes,edges:edges});
252
+ // overall trust sphere = fraction covered (honest, <1.0)
253
+ var tot=_rows.length||1; var frac=counts.cov/tot;
254
+ scene.addTrustSphere({lambda:Math.min(0.999, 1-frac*0.6)});
255
+ scene.setLambda(Math.min(0.999, 1-frac*0.6));
256
+ }catch(e){}
257
+ COV.textContent=counts.cov; PAR.textContent=counts.par; GAP.textContent=counts.gap+(counts.na?(' (+'+counts.na+' N/A)'):'');
258
+ }
259
+
260
+ // signed evidence pulse: light the edge of a COVERED control that is receipt-backed
261
+ function evidencePulse(){
262
+ if(!scene||!_rows.length)return;
263
+ // pulse the first COVERED control edge (covered controls are receipt-backed per the matrix)
264
+ for(var i=0;i<_rows.length;i++){ if(covClass(_rows[i].coverage)==='cov'){ try{scene.signPulse('g'+i);}catch(_){} pulses++; PUL.textContent=pulses; return; } }
265
+ }
266
+
267
+ function load(){
268
+ getJSON(GAPI+'/matrix').then(function(m){
269
+ _rows=(m&&m.matrix)||[];
270
+ // mark signed controls from oscal if available (honest evidence linkage)
271
+ build();
272
+ });
273
+ }
274
+
275
+ function start(){
276
+ if(started)return; started=true;
277
+ mount.style.display='block'; offEl.style.display='none'; toggle.textContent='Disable 3D';
278
+ scene=window.SZLHolo.createScene(mount,{sample:false});
279
+ var caps=window.SZLHolo.capabilities();
280
+ CAP.textContent='mode:'+caps.mode+(caps.webgpu?' · webgpu-detected(ROADMAP)':'');
281
+ scene.start();
282
+ load();
283
+ anim=setInterval(evidencePulse,2800);
284
+ }
285
+ function stop(){
286
+ if(!started)return; started=false;
287
+ mount.style.display='none'; offEl.style.display='block'; toggle.textContent='Enable 3D';
288
+ if(anim)clearInterval(anim);
289
+ try{ if(scene){scene.stop();scene.dispose();} }catch(e){}
290
+ scene=null;
291
+ }
292
+ toggle.addEventListener('click',function(){ started?stop():start(); });
293
+ })();
294
+ </script>
295
+
296
  <script>
297
  "use strict";
298
  const API="/api/__NS__/v1/grc";