File size: 13,056 Bytes
0427fad | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SnapKitty Nemotron Harness</title>
<style>
:root {
--bg: #0d1117;
--surface: #161b22;
--border: #30363d;
--text: #e6edf3;
--dim: #8b949e;
--accent: #58a6ff;
--green: #3fb950;
--amber: #d29922;
--red: #f85149;
--font: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}
*{margin:0;padding:0;box-sizing:border-box}
body{background:var(--bg);color:var(--text);font-family:var(--font);padding:24px;max-width:1080px;margin:0 auto}
h1{font-size:18px;font-weight:600;letter-spacing:0.5px;padding-bottom:12px;border-bottom:1px solid var(--border);margin-bottom:8px}
.sub{color:var(--dim);font-size:12px;margin-bottom:20px}
.panel{background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:16px;margin-bottom:16px}
.grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:16px}
.triple{display:grid;grid-template-columns:1fr 1fr 1fr;gap:12px;margin-bottom:16px}
label{font-size:11px;color:var(--dim);display:block;margin-bottom:4px}
textarea,input{width:100%;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:8px 12px;font-family:var(--font);font-size:13px}
select{width:100%;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:8px 12px;font-family:var(--font);font-size:13px}
textarea{height:80px;resize:vertical;line-height:1.5}
button{background:var(--accent);color:#fff;border:none;border-radius:6px;padding:8px 20px;font-family:var(--font);font-size:13px;font-weight:500;cursor:pointer}
button:hover{opacity:0.9}
pre{font-size:12px;line-height:1.6;color:var(--text);white-space:pre-wrap;max-height:400px;overflow:auto;margin:0}
.mono{font-family:var(--font);font-size:12px}
.green{color:var(--green)}
.amber{color:var(--amber)}
.red{color:var(--red)}
.dim{color:var(--dim)}
.stat{font-size:11px;padding:2px 0}
.badge{display:inline-block;padding:1px 8px;border-radius:4px;font-size:10px;font-weight:500}
.badge.green{background:#1a3a2a;color:var(--green)}
.badge.amber{background:#2d2410;color:var(--amber)}
.badge.red{background:#3a1a1a;color:var(--red)}
.tok{color:var(--accent)}
.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
@media (max-width: 840px){.grid,.triple{grid-template-columns:1fr}}
</style>
</head>
<body>
<h1>SNAPKITTY NEMOTRON HARNESS</h1>
<p class="sub">Constitutional AI · Plasma Gate Kernel · WORM-sealed · Bifrost Audited</p>
<div class="grid">
<div class="panel">
<div class="dim" style="font-size:11px;margin-bottom:4px">MODEL</div>
<div style="font-size:13px">snapkitty-nemotron</div>
<div style="font-size:11px;color:var(--green);margin-top:2px">constitutional AI</div>
</div>
<div class="panel">
<div style="display:flex;gap:12px;flex-wrap:wrap">
<div><div class="dim" style="font-size:11px">MODE</div><div style="font-size:13px">executor</div></div>
<div><div class="dim" style="font-size:11px">ROLE</div><div style="font-size:13px">untrusted compute</div></div>
<div><div class="dim" style="font-size:11px">KERNEL</div><div style="font-size:13px;color:var(--accent)">plasma_gate.pl</div></div>
<div><div class="dim" style="font-size:11px">AXIOMS</div><div style="font-size:13px"><span id="axiomCount" class="green">14</span></div></div>
</div>
</div>
</div>
<div class="triple">
<div class="panel">
<div class="dim" style="font-size:11px;margin-bottom:4px">OLLAMA</div>
<div id="ollamaHealth" style="font-size:13px">Checking…</div>
<div id="ollamaBase" class="dim" style="font-size:11px;margin-top:4px"></div>
</div>
<div class="panel">
<div class="dim" style="font-size:11px;margin-bottom:4px">RESOLVED MODEL</div>
<div id="resolvedModel" style="font-size:13px">—</div>
<div id="modelCount" class="dim" style="font-size:11px;margin-top:4px"></div>
</div>
<div class="panel">
<div class="dim" style="font-size:11px;margin-bottom:4px">RECEIPTS</div>
<div id="receiptDir" style="font-size:13px">—</div>
<div id="kernelStatus" class="dim" style="font-size:11px;margin-top:4px"></div>
</div>
</div>
<div class="panel">
<div class="grid" style="margin-bottom:12px">
<div>
<label>Model</label>
<select id="modelSelect"></select>
</div>
<div>
<label>Prompt preset</label>
<select id="presetSelect">
<option value="">Custom prompt</option>
<option value="⚙️ Review the current Lean file. Emit <|lean_gate|>. Seal all results with <|receipt_seal|>.">Lean gate review</option>
<option value="⚙️ Read the trust deed through <|file_read|> and summarize allowed syscalls. Seal result with <|receipt_seal|>.">Trust deed summary</option>
<option value="⚙️ Run in executor mode. Classify this task as ACCEPTED, APPROVAL_REQUIRED, or REJECTED and emit the needed syscall tokens only.">Gate-only classification</option>
</select>
</div>
</div>
<label>Prompt</label>
<textarea id="promptInput" placeholder="Enter a task for the model..."></textarea>
<div class="row" style="margin-top:10px">
<button onclick="runPrompt()">Run</button>
<button onclick="runRawPrompt()" style="background:transparent;border:1px solid var(--border)">Raw</button>
<button onclick="refreshHealth()" style="background:transparent;border:1px solid var(--border)">Refresh</button>
<span id="status" class="dim" style="font-size:12px"></span>
</div>
</div>
<div class="panel">
<div style="display:flex;justify-content:space-between;margin-bottom:10px">
<div style="font-size:13px;font-weight:500">Model Output</div>
<div id="gateDisplay" class="dim" style="font-size:11px"></div>
</div>
<pre id="modelOutput" style="min-height:60px">Run a prompt to see output.</pre>
</div>
<div id="resultsArea" style="display:none">
<div class="grid">
<div class="panel">
<div style="font-size:13px;font-weight:500;margin-bottom:8px">Syscalls</div>
<div id="syscallList" class="mono"></div>
</div>
<div class="panel">
<div style="font-size:13px;font-weight:500;margin-bottom:8px">Axiom Execution (Plasma Gate)</div>
<div id="axiomList" class="mono"></div>
</div>
</div>
<div class="panel">
<div style="font-size:13px;font-weight:500;margin-bottom:8px">Receipt</div>
<div id="receiptDisplay" class="mono" style="font-size:11px;line-height:1.8"></div>
</div>
</div>
<script>
const promptInput = document.getElementById("promptInput");
const modelSelect = document.getElementById("modelSelect");
const presetSelect = document.getElementById("presetSelect");
presetSelect.addEventListener("change", () => {
if (presetSelect.value) promptInput.value = presetSelect.value;
});
async function fetchJson(url, options) {
const response = await fetch(url, options);
const data = await response.json();
if (!response.ok) throw new Error(data.error || `Request failed (${response.status})`);
return data;
}
async function refreshHealth() {
try {
const [health, models] = await Promise.all([
fetchJson("/api/health"),
fetchJson("/api/models")
]);
document.getElementById("ollamaHealth").innerHTML = `<span class="green">Connected</span>`;
document.getElementById("ollamaBase").textContent = health.ollama.baseUrl;
document.getElementById("resolvedModel").textContent = models.resolvedModel || "—";
document.getElementById("modelCount").textContent = `${models.models.length} model(s) visible`;
document.getElementById("receiptDir").textContent = health.receipts.dir;
document.getElementById("kernelStatus").textContent = `plasma=${health.kernel.plasmaGate ? "on" : "off"} · lean=${health.lean.exists ? "on" : "off"}`;
const current = modelSelect.value;
modelSelect.innerHTML = "";
models.models.forEach((model) => {
const option = document.createElement("option");
option.value = model.name;
option.textContent = `${model.name}${model.name === models.resolvedModel ? " (default)" : ""}`;
modelSelect.appendChild(option);
});
if (current && [...modelSelect.options].some(option => option.value === current)) {
modelSelect.value = current;
} else if (models.resolvedModel) {
modelSelect.value = models.resolvedModel;
}
} catch (error) {
document.getElementById("ollamaHealth").innerHTML = `<span class="red">Offline</span>`;
document.getElementById("ollamaBase").textContent = error.message;
document.getElementById("status").textContent = "health check failed";
}
}
async function runPrompt() {
const prompt = document.getElementById("promptInput").value.trim();
if (!prompt) return;
const el = document.getElementById("modelOutput");
el.textContent = "Running...";
document.getElementById("status").textContent = "querying model...";
document.getElementById("resultsArea").style.display = "none";
try {
const data = await fetchJson("/api/ollama", {
method: "POST",
headers: {"Content-Type":"application/json"},
body: JSON.stringify({ prompt, model: modelSelect.value || undefined })
});
el.textContent = data.raw;
document.getElementById("status").textContent = `done · ${data.usedModel}`;
document.getElementById("gateDisplay").textContent = data.receipt.status;
// Syscalls
const syscalls = data.syscalls;
let shtml = "";
if (syscalls.detected.length === 0) {
shtml = '<span class="dim">No syscall tokens detected</span>';
} else {
syscalls.gate.forEach((g) => {
const cls = g.verdict === "ALLOW" ? "green" : g.verdict === "APPROVAL_REQUIRED" ? "amber" : "red";
shtml += `<div style="display:flex;justify-content:space-between;padding:3px 0">`;
shtml += `<span class="tok"><|${g.syscall}|></span> <span class="badge ${cls}">${g.verdict}</span></div>`;
});
}
document.getElementById("syscallList").innerHTML = shtml;
// Axioms
const ax = data.axioms;
let ahtml = `<div style="margin-bottom:6px">Status: <span class="${ax.allPass ? 'green' : 'red'}">${ax.allPass ? 'ALL PASS' : 'SOME FAILED'}</span></div>`;
ax.results.forEach((r) => {
const cls = r.pass ? "green" : "red";
const name = r.id.replace("ax_", "");
ahtml += `<div style="padding:3px 0;border-bottom:1px solid var(--border);display:flex;justify-content:space-between">`;
ahtml += `<span><span class="${cls}" style="font-weight:500;margin-right:6px">${r.pass ? '✓' : '✗'}</span>${name}</span>`;
ahtml += `<span class="dim" style="font-size:11px">${r.output}</span></div>`;
});
document.getElementById("axiomList").innerHTML = ahtml;
// Receipt
const rc = data.receipt;
document.getElementById("receiptDisplay").innerHTML = `
<div><span class="dim">ID</span> <span class="green">${rc.id}</span></div>
<div><span class="dim">Time</span> ${rc.timestamp}</div>
<div><span class="dim">Model</span> ${data.usedModel}</div>
<div><span class="dim">Status</span> <span class="${rc.status === 'ACCEPTED' ? 'green' : rc.status === 'APPROVAL_REQUIRED' ? 'amber' : 'red'}">${rc.status}</span></div>
<div><span class="dim">Kernel</span> ${rc.kernel}</div>
<div><span class="dim">Trust Deed</span> ${rc.trust_deed} v${rc.version}</div>
<div><span class="dim">Receipt Dir</span> ${rc.receiptsDir}</div>
<div><span class="dim">Axioms</span> ${ax.allPass ? 'PASS' : 'FAIL'} (${ax.results.filter(r => r.pass).length}/${ax.results.length})</div>
<div><span class="dim">Syscalls</span> ${rc.syscalls.detected.length > 0 ? rc.syscalls.detected.map(s => '<|' + s + '|>').join(', ') : 'none'}</div>`;
document.getElementById("resultsArea").style.display = "block";
} catch (e) {
el.textContent = "Error: " + e.message;
document.getElementById("status").textContent = "error";
}
}
async function runRawPrompt() {
const prompt = document.getElementById("promptInput").value.trim();
if (!prompt) return;
const el = document.getElementById("modelOutput");
el.textContent = "Running raw prompt...";
document.getElementById("status").textContent = "querying raw model...";
document.getElementById("resultsArea").style.display = "none";
try {
const data = await fetchJson("/api/ollama/raw", {
method: "POST",
headers: {"Content-Type":"application/json"},
body: JSON.stringify({ prompt, model: modelSelect.value || undefined })
});
el.textContent = data.output;
document.getElementById("status").textContent = `raw done · ${data.model}`;
document.getElementById("gateDisplay").textContent = "raw";
} catch (e) {
el.textContent = "Error: " + e.message;
document.getElementById("status").textContent = "raw error";
}
}
refreshHealth();
</script>
</body>
</html>
|