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: 934 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>
static/3d/holographic.html
CHANGED
|
@@ -174,6 +174,7 @@ const SURFACES = [
|
|
| 174 |
{ id: "fmverif", title: "Proof-Carrying Inference (Machine-Checkable Certificates)", mod: "/static/3d/surfaces/fmverif.js" },
|
| 175 |
{ id: "supplychain", title: "Model-Artifact Provenance (SLSA / in-toto / Rekor / C2PA)", mod: "/static/3d/surfaces/supplychain.js" },
|
| 176 |
{ id: "hybridssm", title: "HybridSSM · Attention vs State-Space vs Hybrid Frontier (synthesis)", mod: "/static/3d/surfaces/hybridssm.js" },
|
|
|
|
| 177 |
];
|
| 178 |
|
| 179 |
const stageEl = document.getElementById("stage");
|
|
|
|
| 174 |
{ id: "fmverif", title: "Proof-Carrying Inference (Machine-Checkable Certificates)", mod: "/static/3d/surfaces/fmverif.js" },
|
| 175 |
{ id: "supplychain", title: "Model-Artifact Provenance (SLSA / in-toto / Rekor / C2PA)", mod: "/static/3d/surfaces/supplychain.js" },
|
| 176 |
{ id: "hybridssm", title: "HybridSSM · Attention vs State-Space vs Hybrid Frontier (synthesis)", mod: "/static/3d/surfaces/hybridssm.js" },
|
| 177 |
+
{ id: "governedagent", title: "Governed Agent Loop · plan→act→self-eval→gate→retry", mod: "/static/3d/surfaces/governedagent.js" },
|
| 178 |
];
|
| 179 |
|
| 180 |
const stageEl = document.getElementById("stage");
|
static/3d/surfaces/governedagent.js
ADDED
|
@@ -0,0 +1,448 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// SPDX-License-Identifier: Apache-2.0
|
| 2 |
+
// © 2026 Lutar, Stephen P. Jr. — SZL Holdings · ORCID 0009-0001-0110-4173 · Doctrine v11
|
| 3 |
+
//
|
| 4 |
+
// surfaces/governedagent.js — GOVERNED AGENT LOOP holographic surface (Wave J · Dev 5).
|
| 5 |
+
//
|
| 6 |
+
// Technique modeled (NOT claimed-as): the agent-framework closed loop
|
| 7 |
+
// plan → act → self-eval → gate → retry, folded into OUR governed ecosystem.
|
| 8 |
+
// Studied leaders (citable, non-leaked):
|
| 9 |
+
// · LangGraph — stateful graph, conditional retry edges, interrupt() HITL
|
| 10 |
+
// https://langchain-ai.github.io/langgraph/
|
| 11 |
+
// · OpenAI Agents SDK — guardrails + approval interruptions + resumable state
|
| 12 |
+
// https://openai.github.io/openai-agents-js/guides/human-in-the-loop/
|
| 13 |
+
// · CrewAI — task guardrail callbacks + bounded retry https://docs.crewai.com/
|
| 14 |
+
// · AutoGen — reflection loops + human_input_mode gate
|
| 15 |
+
// https://microsoft.github.io/autogen/
|
| 16 |
+
// · Anthropic MCP — host composes servers; sensitive actions host-gated
|
| 17 |
+
// https://modelcontextprotocol.io/
|
| 18 |
+
// SZL's differentiator no leader ships: EVERY step's plan+act+eval+gate is folded
|
| 19 |
+
// into ONE ECDSA-P256 DSSE-signed composite receipt (hash-chained), forum-ingested.
|
| 20 |
+
// This surface COMPOSES three existing siloed pieces — the /code run-loop (act),
|
| 21 |
+
// the model-harness (behavior profile), and the eval-arena (self-eval) — plus the
|
| 22 |
+
// durable HumanApprovalGate, into ONE governed autonomous loop.
|
| 23 |
+
//
|
| 24 |
+
// EVERY value on screen traces to a REAL a11oy endpoint (doctrine v11 — never fabricate):
|
| 25 |
+
// * GET /api/a11oy/v1/agentloop/health — composition liveness + signer mode
|
| 26 |
+
// * POST /api/a11oy/v1/agentloop/run — the governed loop → ONE composite receipt
|
| 27 |
+
//
|
| 28 |
+
// The scene: a horizontal PIPELINE of stage nodes (plan · act · self-eval · gate ·
|
| 29 |
+
// receipt), a run BEAM that flows left→right when a run fires, per-STEP satellites
|
| 30 |
+
// that light by eval accuracy / gate verdict, and a floating composite-RECEIPT panel
|
| 31 |
+
// showing the live signed hash-chain. Honesty labels read straight from the JSON.
|
| 32 |
+
// Degrades gracefully; no crash, no fake data. 0 runtime CDN (three via importmap).
|
| 33 |
+
|
| 34 |
+
const ID = "governedagent";
|
| 35 |
+
const TITLE = "Governed Agent Loop · plan→act→self-eval→gate→retry";
|
| 36 |
+
const EP_HEALTH = "/api/a11oy/v1/agentloop/health";
|
| 37 |
+
const EP_RUN = "/api/a11oy/v1/agentloop/run";
|
| 38 |
+
|
| 39 |
+
// palette (matches the estate)
|
| 40 |
+
const C_STAGE = 0x6fb1ff; // pipeline stage node — blue
|
| 41 |
+
const C_ACT = 0xe8c074; // act (engine) — gold
|
| 42 |
+
const C_EVAL = 0x39d3c4; // self-eval — teal
|
| 43 |
+
const C_GATE = 0xff9b6b; // gate — amber
|
| 44 |
+
const C_OK = 0x2fd07a; // pass — green
|
| 45 |
+
const C_DIM = 0x4a5a68;
|
| 46 |
+
|
| 47 |
+
const STAGES = [
|
| 48 |
+
{ key: "plan", label: "plan", sub: "MODELED", color: C_STAGE },
|
| 49 |
+
{ key: "act", label: "act", sub: "engine P1-P6 · Λ-gate · sandbox", color: C_ACT },
|
| 50 |
+
{ key: "eval", label: "self-eval", sub: "eval-arena · Λ axes", color: C_EVAL },
|
| 51 |
+
{ key: "gate", label: "gate", sub: "HumanApprovalGate", color: C_GATE },
|
| 52 |
+
{ key: "receipt", label: "receipt", sub: "ONE composite DSSE", color: C_OK },
|
| 53 |
+
];
|
| 54 |
+
|
| 55 |
+
let _stage = null, _THREE = null, _ctx = null;
|
| 56 |
+
let _group = null, _overlay = null, _frameReg = false;
|
| 57 |
+
let _stageNodes = []; // { mesh, label, key }
|
| 58 |
+
let _beam = null, _billboard = null, _badge = null, _poll = null;
|
| 59 |
+
let _stepSats = []; // per-step satellites
|
| 60 |
+
|
| 61 |
+
const S = {
|
| 62 |
+
state: "init", degraded: false, label: null,
|
| 63 |
+
composes: null, signerMode: null,
|
| 64 |
+
task: "write a python function that returns the first 5 primes",
|
| 65 |
+
mode: "code", model: "claude_opus_4_8", profile: "", suite: "",
|
| 66 |
+
running: false, lastResult: null, lastReceipt: null, runState: "idle",
|
| 67 |
+
};
|
| 68 |
+
|
| 69 |
+
// =========================================================================================
|
| 70 |
+
// mount
|
| 71 |
+
// =========================================================================================
|
| 72 |
+
function mount(ctx) {
|
| 73 |
+
_ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
|
| 74 |
+
const THREE = _THREE;
|
| 75 |
+
_group = new THREE.Group();
|
| 76 |
+
_stage.scene.add(_group);
|
| 77 |
+
if (_stage.camera && _stage.camera.position) _stage.camera.position.set(0, 6, 20);
|
| 78 |
+
try { _stage.setBloom(true); } catch (_) {}
|
| 79 |
+
|
| 80 |
+
_buildPipeline();
|
| 81 |
+
_buildBeam();
|
| 82 |
+
try {
|
| 83 |
+
_billboard = ctx.label.billboard(THREE, "MODELED", { text: "plan modeled · act+eval+gate+receipt live", scale: 0.6, position: [0, 6.4, 0] });
|
| 84 |
+
_group.add(_billboard);
|
| 85 |
+
} catch (_) {}
|
| 86 |
+
|
| 87 |
+
_buildOverlay();
|
| 88 |
+
if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
|
| 89 |
+
|
| 90 |
+
// ---- LIVE WIRING (doctrine: every value traces to a real endpoint) ----
|
| 91 |
+
_poll = ctx.live.poll(EP_HEALTH, 9000, _onHealth, {
|
| 92 |
+
badge: _badge,
|
| 93 |
+
onState: (m) => { S.state = m.state; S.label = m.label || S.label; if (m.state !== "live") _paintOverlay(); },
|
| 94 |
+
});
|
| 95 |
+
|
| 96 |
+
return { id: ID, started: true };
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
// =========================================================================================
|
| 100 |
+
// scene builders
|
| 101 |
+
// =========================================================================================
|
| 102 |
+
function _buildPipeline() {
|
| 103 |
+
const THREE = _THREE;
|
| 104 |
+
_stageNodes = [];
|
| 105 |
+
const n = STAGES.length;
|
| 106 |
+
const span = 14;
|
| 107 |
+
STAGES.forEach((st, i) => {
|
| 108 |
+
const x = -span / 2 + (span / Math.max(n - 1, 1)) * i;
|
| 109 |
+
const mesh = new THREE.Mesh(
|
| 110 |
+
new THREE.IcosahedronGeometry(0.9, 1),
|
| 111 |
+
new THREE.MeshStandardMaterial({ color: st.color, emissive: st.color, emissiveIntensity: 0.4, metalness: 0.4, roughness: 0.45, transparent: true, opacity: 0.9 }),
|
| 112 |
+
);
|
| 113 |
+
mesh.position.set(x, 1.4, 0);
|
| 114 |
+
_group.add(mesh);
|
| 115 |
+
// connector rail to previous node
|
| 116 |
+
if (i > 0) {
|
| 117 |
+
const prev = _stageNodes[i - 1].mesh.position;
|
| 118 |
+
const rail = new THREE.Mesh(
|
| 119 |
+
new THREE.CylinderGeometry(0.04, 0.04, prev.distanceTo(mesh.position), 8),
|
| 120 |
+
new THREE.MeshBasicMaterial({ color: C_DIM, transparent: true, opacity: 0.5 }),
|
| 121 |
+
);
|
| 122 |
+
const mid = prev.clone().add(mesh.position).multiplyScalar(0.5);
|
| 123 |
+
rail.position.copy(mid);
|
| 124 |
+
rail.lookAt(mesh.position); rail.rotateX(Math.PI / 2);
|
| 125 |
+
_group.add(rail);
|
| 126 |
+
}
|
| 127 |
+
let label = null;
|
| 128 |
+
try {
|
| 129 |
+
label = _ctx.label.billboard(_THREE, st.label, { text: st.sub, scale: 0.4, position: [x, 2.7, 0] });
|
| 130 |
+
_group.add(label);
|
| 131 |
+
} catch (_) {}
|
| 132 |
+
_stageNodes.push({ mesh, label, key: st.key });
|
| 133 |
+
});
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
function _buildBeam() {
|
| 137 |
+
const THREE = _THREE;
|
| 138 |
+
const geo = new THREE.SphereGeometry(0.35, 16, 16);
|
| 139 |
+
const mat = new THREE.MeshBasicMaterial({ color: 0xffffff, transparent: true, opacity: 0.0 });
|
| 140 |
+
_beam = new THREE.Mesh(geo, mat);
|
| 141 |
+
_beam.visible = false;
|
| 142 |
+
_group.add(_beam);
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
function _renderStepSats(steps) {
|
| 146 |
+
const THREE = _THREE;
|
| 147 |
+
_stepSats.forEach((s) => { try { _group.remove(s.mesh); } catch (_) {} try { if (s.label) _group.remove(s.label); } catch (_) {} });
|
| 148 |
+
_stepSats = [];
|
| 149 |
+
if (!Array.isArray(steps)) return;
|
| 150 |
+
steps.forEach((st, i) => {
|
| 151 |
+
const fin = st.final || {};
|
| 152 |
+
const ev = fin.eval || {};
|
| 153 |
+
const acc = typeof ev.accuracy === "number" ? ev.accuracy : null;
|
| 154 |
+
const denied = fin.engine && fin.engine.decision === "DENY";
|
| 155 |
+
const col = denied ? C_GATE : (acc !== null && acc >= 0.5 ? C_OK : C_ACT);
|
| 156 |
+
const mesh = new THREE.Mesh(
|
| 157 |
+
new THREE.OctahedronGeometry(0.55, 0),
|
| 158 |
+
new THREE.MeshStandardMaterial({ color: col, emissive: col, emissiveIntensity: 0.55, metalness: 0.3, roughness: 0.5, transparent: true, opacity: 0.92 }),
|
| 159 |
+
);
|
| 160 |
+
const ang = (i / Math.max(steps.length, 1)) * Math.PI * 2;
|
| 161 |
+
mesh.position.set(Math.cos(ang) * 3.4, -2.6, Math.sin(ang) * 3.4 - 1.5);
|
| 162 |
+
_group.add(mesh);
|
| 163 |
+
let label = null;
|
| 164 |
+
try {
|
| 165 |
+
const lab = "step " + (st.n != null ? st.n : i + 1);
|
| 166 |
+
const sub = (acc !== null ? "acc " + acc : "acc —") + (st.retries ? " · retry " + st.retries : "");
|
| 167 |
+
label = _ctx.label.billboard(_THREE, lab, { text: sub, scale: 0.36, position: [mesh.position.x, mesh.position.y + 1.0, mesh.position.z] });
|
| 168 |
+
_group.add(label);
|
| 169 |
+
} catch (_) {}
|
| 170 |
+
_stepSats.push({ mesh, label });
|
| 171 |
+
});
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
// =========================================================================================
|
| 175 |
+
// live-data handlers — read REAL values; never invent
|
| 176 |
+
// =========================================================================================
|
| 177 |
+
function _onHealth(json, meta) {
|
| 178 |
+
S.degraded = !!meta.degraded;
|
| 179 |
+
S.label = meta.label || S.label;
|
| 180 |
+
if (!json) { _paintOverlay(); return; }
|
| 181 |
+
S.composes = json.composes || null;
|
| 182 |
+
S.signerMode = json.signature_mode || null;
|
| 183 |
+
if (Array.isArray(json.eval_suites) && json.eval_suites.length && !S.suite) {
|
| 184 |
+
// leave suite blank (per-step heuristic) but expose the roster in the selector
|
| 185 |
+
S._suites = json.eval_suites;
|
| 186 |
+
}
|
| 187 |
+
_paintOverlay();
|
| 188 |
+
if (_billboard && _ctx && S.composes) {
|
| 189 |
+
try {
|
| 190 |
+
const avail = Object.values(S.composes).filter(Boolean).length;
|
| 191 |
+
const tot = Object.keys(S.composes).length;
|
| 192 |
+
_group.remove(_billboard);
|
| 193 |
+
_billboard = _ctx.label.billboard(_THREE, "COMPOSES", {
|
| 194 |
+
text: `${avail}/${tot} pieces wired · ${S.signerMode || ""}`, scale: 0.56, position: [0, 6.4, 0],
|
| 195 |
+
});
|
| 196 |
+
_group.add(_billboard);
|
| 197 |
+
} catch (_) {}
|
| 198 |
+
}
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
async function _fireRun() {
|
| 202 |
+
if (S.running) return;
|
| 203 |
+
S.running = true; S.runState = "running"; _paintOverlay(); _animateBeam();
|
| 204 |
+
try {
|
| 205 |
+
const body = {
|
| 206 |
+
task: (_el.task && _el.task.value) || S.task,
|
| 207 |
+
mode: (_el.modeSel && _el.modeSel.value) || S.mode,
|
| 208 |
+
model_id: (_el.modelSel && _el.modelSel.value) || S.model,
|
| 209 |
+
max_retries: 1,
|
| 210 |
+
};
|
| 211 |
+
if (_el.profile && _el.profile.value.trim()) body.harness_profile_id = _el.profile.value.trim();
|
| 212 |
+
if (_el.suiteSel && _el.suiteSel.value) body.eval_suite = _el.suiteSel.value;
|
| 213 |
+
const res = await fetch(EP_RUN, {
|
| 214 |
+
method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body),
|
| 215 |
+
});
|
| 216 |
+
if (!res.ok) { S.runState = "error(" + res.status + ")"; S.running = false; _paintOverlay(); return; }
|
| 217 |
+
const json = await res.json();
|
| 218 |
+
S.lastResult = json;
|
| 219 |
+
S.lastReceipt = (json.composite_receipt && json.composite_receipt.body) || null;
|
| 220 |
+
S.runState = json.ok ? "done" : "blocked";
|
| 221 |
+
_renderStepSats(json.steps || []);
|
| 222 |
+
_paintOverlay(); _paintReceipt();
|
| 223 |
+
} catch (e) {
|
| 224 |
+
S.runState = "error";
|
| 225 |
+
} finally {
|
| 226 |
+
S.running = false; _paintOverlay();
|
| 227 |
+
}
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
function _animateBeam() {
|
| 231 |
+
if (!_beam || !_stageNodes.length) return;
|
| 232 |
+
_beam.visible = true;
|
| 233 |
+
_beam.material.opacity = 0.9;
|
| 234 |
+
_beam.userData.t = 0;
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
// =========================================================================================
|
| 238 |
+
// per-frame animation
|
| 239 |
+
// =========================================================================================
|
| 240 |
+
function _onFrame() {
|
| 241 |
+
_stageNodes.forEach((n, i) => { n.mesh.rotation.y += 0.006 + i * 0.001; });
|
| 242 |
+
_stepSats.forEach((s, i) => { s.mesh.rotation.y += 0.01 + i * 0.002; });
|
| 243 |
+
if (_beam && _beam.visible && _stageNodes.length) {
|
| 244 |
+
_beam.userData.t = (_beam.userData.t || 0) + 0.012;
|
| 245 |
+
const t = _beam.userData.t;
|
| 246 |
+
const seg = Math.min(_stageNodes.length - 1, Math.floor(t * (_stageNodes.length - 1)));
|
| 247 |
+
const frac = (t * (_stageNodes.length - 1)) - seg;
|
| 248 |
+
const a = _stageNodes[seg].mesh.position;
|
| 249 |
+
const b = _stageNodes[Math.min(seg + 1, _stageNodes.length - 1)].mesh.position;
|
| 250 |
+
_beam.position.lerpVectors(a, b, frac);
|
| 251 |
+
if (t >= 1) { _beam.visible = false; _beam.material.opacity = 0; }
|
| 252 |
+
}
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
// =========================================================================================
|
| 256 |
+
// DOM overlay (HUD)
|
| 257 |
+
// =========================================================================================
|
| 258 |
+
let _el = {};
|
| 259 |
+
function _buildOverlay() {
|
| 260 |
+
const ctx = _ctx;
|
| 261 |
+
_overlay = document.createElement("div");
|
| 262 |
+
Object.assign(_overlay.style, {
|
| 263 |
+
position: "absolute", left: "14px", top: "14px", zIndex: "6",
|
| 264 |
+
display: "flex", flexDirection: "column", gap: "8px",
|
| 265 |
+
maxWidth: "min(94%,480px)", font: "12px ui-sans-serif,system-ui,Segoe UI,Roboto,Arial", color: "#eef3f6",
|
| 266 |
+
});
|
| 267 |
+
|
| 268 |
+
const h = document.createElement("div");
|
| 269 |
+
h.style.cssText = "font:600 13px ui-sans-serif,system-ui;letter-spacing:.4px";
|
| 270 |
+
h.textContent = TITLE;
|
| 271 |
+
_overlay.appendChild(h);
|
| 272 |
+
|
| 273 |
+
const sub = document.createElement("div");
|
| 274 |
+
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.5";
|
| 275 |
+
sub.innerHTML = 'COMPOSES three siloed pieces into ONE governed loop: ' +
|
| 276 |
+
'<span style="color:#e8c074">/code run-loop</span> (act, Λ-gate, sandbox) · ' +
|
| 277 |
+
'<span style="color:#39d3c4">eval-arena</span> (self-eval) · ' +
|
| 278 |
+
'<span style="color:#6fb1ff">model-harness</span> (behavior profile) · ' +
|
| 279 |
+
'HumanApprovalGate → <b>ONE composite signed receipt</b> chaining profile+step+eval, forum-ingested. ' +
|
| 280 |
+
'Plan MODELED; act+eval+gate+receipt LIVE. Λ = Conjecture 1 (advisory, never green).';
|
| 281 |
+
_overlay.appendChild(sub);
|
| 282 |
+
|
| 283 |
+
_badge = ctx.live.createBadge();
|
| 284 |
+
const badgeRow = document.createElement("div");
|
| 285 |
+
badgeRow.style.cssText = "display:flex;flex-wrap:wrap;gap:6px;align-items:center";
|
| 286 |
+
const tag = (t) => { const s = document.createElement("span"); s.textContent = t; s.style.cssText = "font:10px ui-monospace,monospace;color:#6fb1ff"; return s; };
|
| 287 |
+
badgeRow.appendChild(tag("agentloop")); badgeRow.appendChild(_badge.el);
|
| 288 |
+
_overlay.appendChild(badgeRow);
|
| 289 |
+
|
| 290 |
+
// composition status row
|
| 291 |
+
_el.composes = document.createElement("div");
|
| 292 |
+
_el.composes.style.cssText = "font:10px ui-monospace,monospace;color:#9fb1bf;line-height:1.6";
|
| 293 |
+
_overlay.appendChild(_el.composes);
|
| 294 |
+
|
| 295 |
+
// run controls
|
| 296 |
+
const ctl = document.createElement("div");
|
| 297 |
+
ctl.style.cssText = "display:flex;flex-direction:column;gap:6px;background:#0a1117;border:1px solid #1d2a36;border-radius:8px;padding:8px";
|
| 298 |
+
const cl = document.createElement("div");
|
| 299 |
+
cl.style.cssText = "font:600 11px ui-sans-serif;color:#e8c074"; cl.textContent = "run the governed loop (plan→act→eval→gate→receipt)";
|
| 300 |
+
ctl.appendChild(cl);
|
| 301 |
+
|
| 302 |
+
_el.task = document.createElement("input");
|
| 303 |
+
_el.task.type = "text"; _el.task.value = S.task;
|
| 304 |
+
_el.task.style.cssText = "background:#06090d;color:#eef3f6;border:1px solid #1d2a36;border-radius:6px;padding:5px;font:11px ui-sans-serif";
|
| 305 |
+
ctl.appendChild(_el.task);
|
| 306 |
+
|
| 307 |
+
const row = document.createElement("div");
|
| 308 |
+
row.style.cssText = "display:flex;gap:6px;flex-wrap:wrap";
|
| 309 |
+
const mkSel = (opts, val) => {
|
| 310 |
+
const s = document.createElement("select");
|
| 311 |
+
s.style.cssText = "background:#06090d;color:#eef3f6;border:1px solid #1d2a36;border-radius:6px;padding:5px;font:11px ui-monospace,monospace";
|
| 312 |
+
opts.forEach((o) => { const op = document.createElement("option"); op.value = o; op.textContent = o; s.appendChild(op); });
|
| 313 |
+
if (val) s.value = val;
|
| 314 |
+
return s;
|
| 315 |
+
};
|
| 316 |
+
_el.modeSel = mkSel(["code", "chat", "research"], S.mode);
|
| 317 |
+
_el.modelSel = mkSel(["claude_opus_4_8", "claude_sonnet_4_6", "gpt_5_4", "sovereign_local"], S.model);
|
| 318 |
+
_el.suiteSel = mkSel(["", "core_honest_v1", "redteam_v1", "honesty_v1"], S.suite);
|
| 319 |
+
row.appendChild(_el.modeSel); row.appendChild(_el.modelSel); row.appendChild(_el.suiteSel);
|
| 320 |
+
ctl.appendChild(row);
|
| 321 |
+
|
| 322 |
+
_el.profile = document.createElement("input");
|
| 323 |
+
_el.profile.type = "text"; _el.profile.placeholder = "harness_profile_id (optional)";
|
| 324 |
+
_el.profile.style.cssText = "background:#06090d;color:#eef3f6;border:1px solid #1d2a36;border-radius:6px;padding:5px;font:11px ui-monospace,monospace";
|
| 325 |
+
ctl.appendChild(_el.profile);
|
| 326 |
+
|
| 327 |
+
_el.runBtn = document.createElement("button");
|
| 328 |
+
_el.runBtn.textContent = "▶ run loop (Λ-gate + self-eval + gate + sign + forum)";
|
| 329 |
+
_el.runBtn.style.cssText = "background:#12202b;color:#eef3f6;border:1px solid #39d3c4;border-radius:7px;padding:7px 10px;cursor:pointer;font:600 11px ui-monospace,monospace";
|
| 330 |
+
_el.runBtn.addEventListener("click", _fireRun);
|
| 331 |
+
ctl.appendChild(_el.runBtn);
|
| 332 |
+
|
| 333 |
+
_el.runState = document.createElement("div");
|
| 334 |
+
_el.runState.style.cssText = "font:10.5px ui-monospace,monospace;color:#9fb1bf";
|
| 335 |
+
_el.runState.textContent = "run state: idle";
|
| 336 |
+
ctl.appendChild(_el.runState);
|
| 337 |
+
_overlay.appendChild(ctl);
|
| 338 |
+
|
| 339 |
+
// composite receipt panel
|
| 340 |
+
const det = document.createElement("details");
|
| 341 |
+
det.open = true;
|
| 342 |
+
const sum = document.createElement("summary");
|
| 343 |
+
sum.style.cssText = "cursor:pointer;color:#39d3c4;font:11px ui-monospace,monospace";
|
| 344 |
+
sum.textContent = "composite signed receipt (szl.agentloop.receipt/v1)";
|
| 345 |
+
_el.receipt = document.createElement("div");
|
| 346 |
+
_el.receipt.style.cssText = "white-space:pre-wrap;font:10px ui-monospace,monospace;color:#bfe;background:#06090d;border:1px solid #1d2a36;border-radius:7px;padding:8px;max-height:230px;overflow:auto;margin-top:6px";
|
| 347 |
+
_el.receipt.textContent = "— run the loop to see the live composite signed receipt —";
|
| 348 |
+
det.appendChild(sum); det.appendChild(_el.receipt);
|
| 349 |
+
_overlay.appendChild(det);
|
| 350 |
+
|
| 351 |
+
// honesty legend
|
| 352 |
+
const lg = ctx.label.legend(); lg.style.opacity = "0.85"; _overlay.appendChild(lg);
|
| 353 |
+
|
| 354 |
+
// sources (text only — NOT fetch-shaped, doctrine 0-CDN safe)
|
| 355 |
+
const src = document.createElement("div");
|
| 356 |
+
src.style.cssText = "font-size:9.5px;color:#5b6c78;line-height:1.6;margin-top:2px";
|
| 357 |
+
src.textContent = "Studied leaders (ingested & re-expressed as ours): LangGraph · OpenAI Agents SDK (guardrails+approvals) · CrewAI · AutoGen · Anthropic MCP. Composes the existing a11oy /code run-loop + eval-arena + model-harness; the composite receipt only CHAINS + SIGNS their REAL output. Plan is MODELED; act+eval+gate+receipt are LIVE; behavior transfer is disposition-only (MODELED). NOT in the locked-8; Λ = Conjecture 1; trust < 100%.";
|
| 358 |
+
_overlay.appendChild(src);
|
| 359 |
+
|
| 360 |
+
(ctx.container || document.body).appendChild(_overlay);
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
function _paintOverlay() {
|
| 364 |
+
if (_el.composes) {
|
| 365 |
+
if (!S.composes) { _el.composes.textContent = "composition: awaiting live health (" + S.state + ")"; }
|
| 366 |
+
else {
|
| 367 |
+
const c = S.composes;
|
| 368 |
+
const mk = (k, on) => (on ? "✓ " : "✗ ") + k;
|
| 369 |
+
_el.composes.textContent = "composition: " + [
|
| 370 |
+
mk("act(engine)", c.act_engine_available),
|
| 371 |
+
mk("plan", c.plan_source_available),
|
| 372 |
+
mk("eval-arena", c.self_eval_available),
|
| 373 |
+
mk("harness", c.behavior_profile_available),
|
| 374 |
+
mk("gate", c.human_gate_available),
|
| 375 |
+
].join(" ") + (S.signerMode ? " · " + S.signerMode : "");
|
| 376 |
+
}
|
| 377 |
+
}
|
| 378 |
+
if (_el.runState) {
|
| 379 |
+
let extra = "";
|
| 380 |
+
if (S.lastResult && S.lastResult.aggregate) {
|
| 381 |
+
const a = S.lastResult.aggregate;
|
| 382 |
+
extra = " · steps " + a.n_steps + " · mean acc " + (a.mean_eval_accuracy != null ? a.mean_eval_accuracy : "—") +
|
| 383 |
+
" · Λ " + (a.mean_eval_lambda != null ? a.mean_eval_lambda : "—") +
|
| 384 |
+
(a.any_gate_hold ? " · GATE HELD" : "") + (a.any_step_denied ? " · DENY" : "");
|
| 385 |
+
}
|
| 386 |
+
_el.runState.textContent = "run state: " + S.runState + extra;
|
| 387 |
+
}
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
function _paintReceipt() {
|
| 391 |
+
if (!_el.receipt) return;
|
| 392 |
+
if (!S.lastReceipt) { _el.receipt.textContent = "— run the loop to see the live composite signed receipt —"; return; }
|
| 393 |
+
const r = S.lastReceipt;
|
| 394 |
+
const res = S.lastResult || {};
|
| 395 |
+
const sig = (res.composite_receipt && res.composite_receipt.signing) || {};
|
| 396 |
+
const agg = r.aggregate || {};
|
| 397 |
+
const lines = [
|
| 398 |
+
"schema : " + (r.schema || "?"),
|
| 399 |
+
"run_id : " + (r.run_id || "?"),
|
| 400 |
+
"task : " + (r.task || ""),
|
| 401 |
+
"mode : " + (r.mode || "?") + " model: " + (r.model_id || "?"),
|
| 402 |
+
"harness_profile : " + (r.harness_profile_id || "(none)"),
|
| 403 |
+
"n_steps : " + (r.n_steps),
|
| 404 |
+
"mean_eval_acc : " + (agg.mean_eval_accuracy != null ? agg.mean_eval_accuracy : "—"),
|
| 405 |
+
"mean_eval_Λ : " + (agg.mean_eval_lambda != null ? agg.mean_eval_lambda : "—") + " (" + (agg.lambda_status || "CONJECTURE") + ")",
|
| 406 |
+
"any_gate_hold : " + agg.any_gate_hold + " any_step_denied: " + agg.any_step_denied,
|
| 407 |
+
"run_chain_digest : " + (r.run_chain_digest || "?"),
|
| 408 |
+
"signature : " + (sig.alg || "?") + " / " + (sig.envelope || "?") + " · mode=" + (sig.mode || "?"),
|
| 409 |
+
" pae_sha256 : " + (sig.pae_sha256 || "?"),
|
| 410 |
+
" honesty : " + (sig.note || "?"),
|
| 411 |
+
"locked8_touched : " + r.locked8_touched,
|
| 412 |
+
"conjecture : " + (r.honest_note || ""),
|
| 413 |
+
"",
|
| 414 |
+
"── step chain (hash-chained) ──",
|
| 415 |
+
];
|
| 416 |
+
(r.step_chain || []).forEach((s) => {
|
| 417 |
+
lines.push(" step " + s.n + " · " + (s.decision || "?") + " · acc " + (s.eval_accuracy != null ? s.eval_accuracy : "—") +
|
| 418 |
+
" · Λ " + (s.eval_lambda != null ? s.eval_lambda : "—") + (s.harness_profile ? " · prof " + s.harness_profile : "") +
|
| 419 |
+
"\n digest " + (s.digest || "").slice(0, 24) + "…");
|
| 420 |
+
});
|
| 421 |
+
_el.receipt.textContent = lines.join("\n");
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
// =========================================================================================
|
| 425 |
+
// unmount
|
| 426 |
+
// =========================================================================================
|
| 427 |
+
function unmount() {
|
| 428 |
+
try { if (_poll) _poll.stop(); } catch (_) {}
|
| 429 |
+
try { if (_overlay && _overlay.parentNode) _overlay.parentNode.removeChild(_overlay); } catch (_) {}
|
| 430 |
+
try {
|
| 431 |
+
if (_group && _stage) {
|
| 432 |
+
_group.traverse((o) => {
|
| 433 |
+
if (o.geometry && o.geometry.dispose) o.geometry.dispose();
|
| 434 |
+
if (o.material) {
|
| 435 |
+
const mats = Array.isArray(o.material) ? o.material : [o.material];
|
| 436 |
+
mats.forEach((m) => { if (m.map && m.map.dispose) m.map.dispose(); if (m.dispose) m.dispose(); });
|
| 437 |
+
}
|
| 438 |
+
});
|
| 439 |
+
_stage.scene.remove(_group);
|
| 440 |
+
}
|
| 441 |
+
} catch (_) {}
|
| 442 |
+
_poll = null; _overlay = _group = _beam = _billboard = null;
|
| 443 |
+
_stageNodes = []; _stepSats = []; _badge = null; _el = {};
|
| 444 |
+
S.composes = null; S.lastResult = null; S.lastReceipt = null; S.running = false;
|
| 445 |
+
_stage = _THREE = _ctx = null;
|
| 446 |
+
}
|
| 447 |
+
|
| 448 |
+
export default { id: ID, title: TITLE, endpoints: [EP_HEALTH, EP_RUN], mount, unmount };
|