interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / crates / spark-cockpit-rs / static / workshop.html

665 lines · 23757 bytes Raw Blame History
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <meta name="color-scheme" content="dark">
7 <meta name="theme-color" content="#090d13">
8 <title>AIEN | Sovereign Distillation Workshop</title>
9 <link rel="stylesheet" href="/style.css">
10 <style>
11 body {
12 overflow-y: auto;
13 min-height: 100vh;
14 background: var(--bg-base);
15 }
16 .workshop-header {
17 display: flex;
18 justify-content: space-between;
19 align-items: center;
20 padding: 12px 24px;
21 background: var(--bg-deck);
22 border-bottom: 1px solid var(--border-subtle);
23 }
24 .workshop-brand {
25 display: flex;
26 align-items: center;
27 gap: 12px;
28 }
29 .workshop-title {
30 font-weight: 700;
31 letter-spacing: 0.08em;
32 color: var(--text-primary);
33 }
34 .workshop-sub {
35 font-size: 11px;
36 color: var(--accent-emerald);
37 letter-spacing: 0.05em;
38 }
39 .btn-nav {
40 padding: 6px 14px;
41 font-size: 12px;
42 font-family: var(--font-mono);
43 color: var(--text-secondary);
44 background: var(--bg-surface);
45 border: 1px solid var(--border-subtle);
46 border-radius: 4px;
47 text-decoration: none;
48 transition: all 0.15s ease;
49 }
50 .btn-nav:hover {
51 color: var(--text-primary);
52 border-color: var(--border-highlight);
53 }
54 .workshop-container {
55 max-width: 1440px;
56 margin: 0 auto;
57 padding: 24px;
58 display: flex;
59 flex-direction: column;
60 gap: 24px;
61 }
62 .section-card {
63 background: var(--bg-surface);
64 border: 1px solid var(--border-subtle);
65 border-radius: 6px;
66 padding: 20px;
67 }
68 .section-title-row {
69 display: flex;
70 justify-content: space-between;
71 align-items: center;
72 margin-bottom: 16px;
73 padding-bottom: 10px;
74 border-bottom: 1px solid var(--border-subtle);
75 }
76 .section-heading {
77 font-size: 14px;
78 font-weight: 600;
79 color: var(--text-primary);
80 text-transform: uppercase;
81 letter-spacing: 0.06em;
82 }
83 .section-desc {
84 font-size: 12px;
85 color: var(--text-secondary);
86 }
87 .models-grid {
88 display: grid;
89 grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
90 gap: 12px;
91 }
92 .model-card {
93 background: var(--bg-surface-elevated);
94 border: 1px solid var(--border-subtle);
95 border-radius: 4px;
96 padding: 12px;
97 display: flex;
98 flex-direction: column;
99 gap: 6px;
100 }
101 .model-card.active {
102 border-color: var(--border-highlight);
103 }
104 .model-name {
105 font-weight: 600;
106 font-size: 13px;
107 color: var(--text-primary);
108 }
109 .model-meta {
110 font-size: 11px;
111 color: var(--text-secondary);
112 display: flex;
113 justify-content: space-between;
114 }
115 .badge {
116 display: inline-block;
117 font-size: 10px;
118 font-weight: 600;
119 padding: 2px 6px;
120 border-radius: 3px;
121 text-transform: uppercase;
122 letter-spacing: 0.05em;
123 }
124 .badge-online {
125 background: var(--accent-emerald-dim);
126 color: var(--accent-emerald);
127 border: 1px solid rgba(16, 185, 129, 0.3);
128 }
129 .badge-resident {
130 background: var(--accent-cyan-dim);
131 color: var(--accent-cyan);
132 border: 1px solid rgba(6, 182, 212, 0.3);
133 }
134 .badge-offline {
135 background: rgba(100, 116, 139, 0.15);
136 color: var(--text-muted);
137 border: 1px solid rgba(100, 116, 139, 0.3);
138 }
139 .split-grid {
140 display: grid;
141 grid-template-columns: 1fr 1fr;
142 gap: 24px;
143 }
144 @media (max-width: 960px) {
145 .split-grid {
146 grid-template-columns: 1fr;
147 }
148 }
149 .form-group {
150 display: flex;
151 flex-direction: column;
152 gap: 6px;
153 margin-bottom: 14px;
154 }
155 .form-label {
156 font-size: 11px;
157 font-weight: 600;
158 color: var(--text-secondary);
159 text-transform: uppercase;
160 letter-spacing: 0.05em;
161 }
162 .form-select, .form-input, .form-textarea {
163 background: var(--bg-surface-elevated);
164 border: 1px solid var(--border-subtle);
165 border-radius: 4px;
166 padding: 8px 12px;
167 color: var(--text-primary);
168 font-family: var(--font-mono);
169 font-size: 12px;
170 transition: border-color 0.15s ease;
171 }
172 .form-select:focus, .form-input:focus, .form-textarea:focus {
173 outline: none;
174 border-color: var(--accent-emerald);
175 }
176 .form-textarea {
177 min-height: 110px;
178 resize: vertical;
179 line-height: 1.4;
180 }
181 .checkbox-row {
182 display: flex;
183 align-items: center;
184 gap: 8px;
185 margin-bottom: 16px;
186 font-size: 12px;
187 color: var(--text-secondary);
188 cursor: pointer;
189 }
190 .checkbox-row input {
191 accent-color: var(--accent-emerald);
192 cursor: pointer;
193 }
194 .btn-action {
195 background: var(--accent-emerald);
196 color: #000;
197 font-weight: 700;
198 font-family: var(--font-mono);
199 font-size: 12px;
200 padding: 10px 20px;
201 border: none;
202 border-radius: 4px;
203 cursor: pointer;
204 transition: opacity 0.15s ease;
205 letter-spacing: 0.05em;
206 }
207 .btn-action:hover:not(:disabled) {
208 opacity: 0.9;
209 }
210 .btn-action:disabled {
211 opacity: 0.5;
212 cursor: not-allowed;
213 }
214 .btn-secondary {
215 background: var(--bg-surface-elevated);
216 color: var(--text-primary);
217 border: 1px solid var(--border-highlight);
218 padding: 8px 16px;
219 font-size: 12px;
220 font-family: var(--font-mono);
221 border-radius: 4px;
222 cursor: pointer;
223 }
224 .btn-secondary:hover:not(:disabled) {
225 background: var(--bg-panel);
226 }
227 .telemetry-strip {
228 display: grid;
229 grid-template-columns: repeat(2, 1fr);
230 gap: 12px;
231 margin-bottom: 16px;
232 }
233 .telemetry-item {
234 background: var(--bg-surface-elevated);
235 border: 1px solid var(--border-subtle);
236 border-radius: 4px;
237 padding: 10px;
238 }
239 .telemetry-label {
240 font-size: 10px;
241 color: var(--text-muted);
242 text-transform: uppercase;
243 letter-spacing: 0.05em;
244 margin-bottom: 4px;
245 }
246 .telemetry-value {
247 font-size: 14px;
248 font-weight: 700;
249 color: var(--text-primary);
250 }
251 .code-box {
252 background: var(--bg-panel);
253 border: 1px solid var(--border-subtle);
254 border-radius: 4px;
255 padding: 12px;
256 font-family: var(--font-mono);
257 font-size: 12px;
258 color: var(--text-code);
259 max-height: 280px;
260 overflow-y: auto;
261 white-space: pre-wrap;
262 word-break: break-word;
263 }
264 .reasoning-box {
265 background: rgba(15, 23, 42, 0.6);
266 border-left: 2px solid var(--accent-amber);
267 padding: 8px 12px;
268 font-size: 11px;
269 color: var(--text-secondary);
270 margin-bottom: 8px;
271 white-space: pre-wrap;
272 max-height: 140px;
273 overflow-y: auto;
274 }
275 .status-banner {
276 padding: 8px 12px;
277 border-radius: 4px;
278 font-size: 12px;
279 font-weight: 600;
280 margin-bottom: 14px;
281 display: flex;
282 justify-content: space-between;
283 align-items: center;
284 }
285 .status-banner.idle {
286 background: var(--bg-surface-elevated);
287 color: var(--text-secondary);
288 border: 1px solid var(--border-subtle);
289 }
290 .status-banner.running {
291 background: var(--accent-amber-dim);
292 color: var(--accent-amber);
293 border: 1px solid rgba(245, 158, 11, 0.3);
294 }
295 .status-banner.success {
296 background: var(--accent-emerald-dim);
297 color: var(--accent-emerald);
298 border: 1px solid rgba(16, 185, 129, 0.3);
299 }
300 .status-banner.error {
301 background: var(--accent-crimson-dim);
302 color: var(--accent-crimson);
303 border: 1px solid rgba(239, 68, 68, 0.3);
304 }
305 .receipt-log {
306 font-size: 11px;
307 color: var(--accent-emerald);
308 padding: 8px 0;
309 }
310 </style>
311</head>
312<body class="obsidian-theme">
313 <header class="workshop-header">
314 <div class="workshop-brand">
315 <div>
316 <div class="workshop-title">AIEN SOVEREIGN DISTILLATION WORKSHOP</div>
317 <div class="workshop-sub">Sovereign Knowledge Distillation Workshop and Cortex Memory Consolidation</div>
318 </div>
319 </div>
320 <div style="display: flex; gap: 10px; align-items: center;">
321 <span class="badge badge-online">TPM 2.0 ACTIVE</span>
322 <a href="/" class="btn-nav">RETURN TO COCKPIT</a>
323 </div>
324 </header>
325
326 <main class="workshop-container">
327 <!-- Section 1: Model Readiness Matrix -->
328 <section class="section-card">
329 <div class="section-title-row">
330 <div>
331 <div class="section-heading">Model Catalog and Silicon Readiness</div>
332 <div class="section-desc">Hardware TPM vault resolution across frontier API keys, web session adapters, and local resident seats.</div>
333 </div>
334 <span id="model-count-badge" class="badge badge-resident">Loading adapters...</span>
335 </div>
336 <div id="models-grid" class="models-grid"></div>
337 </section>
338
339 <!-- Section 2: Distillation Control Deck & Live Telemetry -->
340 <div class="split-grid">
341 <!-- Distillation Form -->
342 <section class="section-card">
343 <div class="section-title-row">
344 <div>
345 <div class="section-heading">Distillation Configuration</div>
346 <div class="section-desc">Select teacher oracle, student resident model, and curriculum track.</div>
347 </div>
348 </div>
349
350 <form id="distill-form">
351 <div class="form-group">
352 <label class="form-label" for="teacher-select">Teacher Oracle Model</label>
353 <select id="teacher-select" class="form-select" required></select>
354 </div>
355
356 <div class="form-group">
357 <label class="form-label" for="student-select">Student Resident Model</label>
358 <select id="student-select" class="form-select">
359 <option value="atlas-lightning-omni">atlas-lightning-omni (local seat, port 18006)</option>
360 </select>
361 </div>
362
363 <div class="form-group">
364 <label class="form-label" for="track-select">Curriculum Track</label>
365 <select id="track-select" class="form-select">
366 <option value="">Custom Manual Prompt</option>
367 <option value="systems">Native Systems and GPU Engineering</option>
368 <option value="agent">Autonomous Agent Agency and Tool Contracts</option>
369 <option value="science">Advanced Scientific and Technical Reasoning</option>
370 <option value="frontier">General Frontier Capabilities and Systems Design</option>
371 <option value="dynamic">Dynamic Repository and Trace Mining</option>
372 </select>
373 </div>
374
375 <div class="form-group">
376 <label class="form-label" for="strategy-select">Verification Strategy</label>
377 <select id="strategy-select" class="form-select">
378 <option value="compiler_check">Sandboxed Compiler (rustc lib check)</option>
379 <option value="unslop_strict">Strict Anti-Slop (Zero Clichés, Zero Dashes)</option>
380 <option value="dual_consensus">Hybrid Consensus (Jaccard, Levenshtein, LCS)</option>
381 <option value="json_schema">JSON Schema Validation</option>
382 </select>
383 </div>
384
385 <div class="form-group">
386 <label class="form-label" for="prompt-input">Task Prompt</label>
387 <textarea id="prompt-input" class="form-textarea" placeholder="Enter problem statement or choose a curriculum track to populate." required></textarea>
388 </div>
389
390 <label class="checkbox-row">
391 <input type="checkbox" id="commit-check" checked>
392 <span>Auto-commit verified solution to Spark Cortex (Score >= 0.85)</span>
393 </label>
394
395 <button type="submit" id="btn-submit" class="btn-action">LAUNCH DISTILLATION</button>
396 </form>
397 </section>
398
399 <!-- Execution Telemetry & Preference Delta -->
400 <section class="section-card">
401 <div class="section-title-row">
402 <div>
403 <div class="section-heading">Execution Telemetry and Preference Ledger</div>
404 <div class="section-desc">Real-time rollout comparison, verifier scoring, and SFT/DPO generation.</div>
405 </div>
406 </div>
407
408 <div id="status-banner" class="status-banner idle">
409 <span id="status-text">Status: IDLE</span>
410 <span id="status-timer"></span>
411 </div>
412
413 <div class="telemetry-strip">
414 <div class="telemetry-item">
415 <div class="telemetry-label">Preference Delta</div>
416 <div id="tele-delta" class="telemetry-value">0.000</div>
417 </div>
418 <div class="telemetry-item">
419 <div class="telemetry-label">Selected Winner</div>
420 <div id="tele-winner" class="telemetry-value">NONE</div>
421 </div>
422 <div class="telemetry-item">
423 <div class="telemetry-label">Verification Score</div>
424 <div id="tele-score" class="telemetry-value">--</div>
425 </div>
426 <div class="telemetry-item">
427 <div class="telemetry-label">Cortex Memory Status</div>
428 <div id="tele-cortex" class="telemetry-value">NOT COMMITTED</div>
429 </div>
430 </div>
431
432 <div style="display: flex; gap: 10px; margin-bottom: 12px;">
433 <button id="btn-manual-commit" class="btn-secondary" disabled>COMMIT CHOSEN TO CORTEX</button>
434 </div>
435
436 <div id="receipt-area" class="receipt-log"></div>
437 </section>
438 </div>
439
440 <!-- Section 3: Dual Rollout Viewer -->
441 <section class="section-card">
442 <div class="section-title-row">
443 <div>
444 <div class="section-heading">Rollout Comparison and Verification Analysis</div>
445 <div class="section-desc">Side-by-side inspection of teacher oracle and student resident generations.</div>
446 </div>
447 </div>
448
449 <div class="split-grid">
450 <div>
451 <div style="font-weight: 600; margin-bottom: 6px; color: var(--accent-emerald);" id="teacher-header">Teacher Oracle Generation</div>
452 <div id="teacher-reasoning" class="reasoning-box" style="display: none;"></div>
453 <div id="teacher-code" class="code-box">Awaiting execution...</div>
454 </div>
455 <div>
456 <div style="font-weight: 600; margin-bottom: 6px; color: var(--accent-cyan);" id="student-header">Student Resident Generation</div>
457 <div id="student-reasoning" class="reasoning-box" style="display: none;"></div>
458 <div id="student-code" class="code-box">Awaiting execution...</div>
459 </div>
460 </div>
461 </section>
462 </main>
463
464 <script>
465 let currentRecord = null;
466 const trackPrompts = {
467 systems: "Implement an allocation-free single-producer single-consumer ring buffer in Rust with acquire-release memory ordering.",
468 agent: "Design an autonomous agent state machine in Rust with states for Idle, Planning, ToolExecution, Verifying, and ErrorRecovery.",
469 science: "Formulate the reaction kinetics and differential rate equations for a multi-step photocatalytic water splitting process on titanium dioxide.",
470 frontier: "Implement a concurrent lock-free skip list in Rust supporting concurrent search, insert, and delete.",
471 dynamic: "Analyze and implement an asynchronous event bus in Rust with decoupled publishers and subscribers."
472 };
473
474 async function loadModels() {
475 try {
476 const res = await fetch("/api/workshop/models");
477 const data = await res.json();
478 const grid = document.getElementById("models-grid");
479 const teacherSelect = document.getElementById("teacher-select");
480 const badge = document.getElementById("model-count-badge");
481
482 grid.innerHTML = "";
483 teacherSelect.innerHTML = "";
484
485 if (data.models) {
486 badge.textContent = `${data.models.length} ADAPTERS DISCOVERED`;
487 data.models.forEach(m => {
488 const card = document.createElement("div");
489 card.className = "model-card" + (m.is_available ? " active" : "");
490
491 let statusBadge = `<span class="badge badge-offline">KEY REQUIRED</span>`;
492 if (m.is_resident) {
493 statusBadge = `<span class="badge badge-resident">RESIDENT (GB10)</span>`;
494 } else if (m.is_available) {
495 statusBadge = `<span class="badge badge-online">ONLINE (TPM)</span>`;
496 }
497
498 card.innerHTML = `
499 <div style="display: flex; justify-content: space-between; align-items: center;">
500 <span class="model-name">${m.name}</span>
501 ${statusBadge}
502 </div>
503 <div class="model-meta">
504 <span>ID: ${m.id}</span>
505 <span>CTX: ${m.context_length.toLocaleString()}</span>
506 </div>
507 `;
508 grid.appendChild(card);
509
510 const opt = document.createElement("option");
511 opt.value = m.id;
512 opt.textContent = `${m.name} (${m.id})`;
513 if (m.is_available || m.is_resident) {
514 teacherSelect.appendChild(opt);
515 }
516 });
517
518 // Default selection priority
519 if (teacherSelect.querySelector("option[value=\"anthropic/claude-3-7-sonnet\"]")) {
520 teacherSelect.value = "anthropic/claude-3-7-sonnet";
521 } else if (teacherSelect.querySelector("option[value=\"openai/gpt-4o\"]")) {
522 teacherSelect.value = "openai/gpt-4o";
523 } else if (teacherSelect.options.length > 0) {
524 teacherSelect.selectedIndex = 0;
525 }
526 }
527 } catch (e) {
528 document.getElementById("model-count-badge").textContent = "DISCOVERY ERROR";
529 }
530 }
531
532 document.getElementById("track-select").addEventListener("change", (e) => {
533 const track = e.target.value;
534 if (trackPrompts[track]) {
535 document.getElementById("prompt-input").value = trackPrompts[track];
536 }
537 });
538
539 document.getElementById("distill-form").addEventListener("submit", async (e) => {
540 e.preventDefault();
541 const btn = document.getElementById("btn-submit");
542 const banner = document.getElementById("status-banner");
543 const statusText = document.getElementById("status-text");
544 const commitBtn = document.getElementById("btn-manual-commit");
545 const receiptArea = document.getElementById("receipt-area");
546
547 btn.disabled = true;
548 commitBtn.disabled = true;
549 banner.className = "status-banner running";
550 statusText.textContent = "Status: EXECUTING ORACLE DISTILLATION AND VERIFICATION...";
551 receiptArea.textContent = "";
552
553 const payload = {
554 teacher_model: document.getElementById("teacher-select").value,
555 student_model: document.getElementById("student-select").value,
556 track: document.getElementById("track-select").value || null,
557 verification_strategy: document.getElementById("strategy-select").value,
558 prompt: document.getElementById("prompt-input").value,
559 commit_to_cortex: document.getElementById("commit-check").checked
560 };
561
562 const t0 = performance.now();
563 try {
564 const res = await fetch("/api/workshop/distill", {
565 method: "POST",
566 headers: { "Content-Type": "application/json" },
567 body: JSON.stringify(payload)
568 });
569 const data = await res.json();
570 const duration = Math.round(performance.now() - t0);
571
572 if (!res.ok) {
573 throw new Error(data.error || "Distillation failed.");
574 }
575
576 const rec = data.record;
577 currentRecord = rec;
578
579 banner.className = "status-banner success";
580 statusText.textContent = `Status: COMPLETED IN ${duration}ms (Task: ${rec.task_id})`;
581
582 document.getElementById("tele-delta").textContent = (rec.preference_delta || 0).toFixed(4);
583 const winner = rec.chosen_reasoning ? "TEACHER" : "STUDENT";
584 document.getElementById("tele-winner").textContent = winner;
585
586 const score = rec.teacher_rollout.verification.score;
587 document.getElementById("tele-score").textContent = `${Math.round(score * 100)}% (${rec.teacher_rollout.verification.passed ? "PASSED" : "FAILED"})`;
588
589 if (rec.durable_memory_committed) {
590 document.getElementById("tele-cortex").textContent = `COMMITTED (${rec.cortex_entity_id || "OK"})`;
591 receiptArea.textContent = `Knowledge entity committed to Cortex: ${rec.cortex_entity_id || rec.task_id}`;
592 } else {
593 document.getElementById("tele-cortex").textContent = "NOT COMMITTED";
594 commitBtn.disabled = false;
595 }
596
597 // Render Teacher
598 document.getElementById("teacher-header").textContent = `Teacher: ${rec.teacher_rollout.model_id} (${rec.teacher_rollout.duration_ms}ms, ${rec.teacher_rollout.token_count} tok)`;
599 const tReason = document.getElementById("teacher-reasoning");
600 if (rec.teacher_rollout.reasoning) {
601 tReason.style.display = "block";
602 tReason.textContent = "Reasoning: " + rec.teacher_rollout.reasoning;
603 } else {
604 tReason.style.display = "none";
605 }
606 document.getElementById("teacher-code").textContent = rec.teacher_rollout.content;
607
608 // Render Student
609 if (rec.student_rollout) {
610 document.getElementById("student-header").textContent = `Student: ${rec.student_rollout.model_id} (${rec.student_rollout.duration_ms}ms, ${rec.student_rollout.token_count} tok)`;
611 const sReason = document.getElementById("student-reasoning");
612 if (rec.student_rollout.reasoning) {
613 sReason.style.display = "block";
614 sReason.textContent = "Reasoning: " + rec.student_rollout.reasoning;
615 } else {
616 sReason.style.display = "none";
617 }
618 document.getElementById("student-code").textContent = rec.student_rollout.content;
619 } else {
620 document.getElementById("student-code").textContent = "No student rollout executed for this task.";
621 }
622
623 } catch (err) {
624 banner.className = "status-banner error";
625 statusText.textContent = "Status: ERROR: " + err.message;
626 } finally {
627 btn.disabled = false;
628 }
629 });
630
631 document.getElementById("btn-manual-commit").addEventListener("click", async () => {
632 if (!currentRecord) return;
633 const btn = document.getElementById("btn-manual-commit");
634 btn.disabled = true;
635
636 try {
637 const payload = {
638 name: `distill_lesson_${currentRecord.task_id}`,
639 content: `Distilled solution for task ${currentRecord.prompt}: ${currentRecord.chosen}`,
640 task_id: currentRecord.task_id,
641 confidence: 0.95
642 };
643 const res = await fetch("/api/workshop/commit", {
644 method: "POST",
645 headers: { "Content-Type": "application/json" },
646 body: JSON.stringify(payload)
647 });
648 const data = await res.json();
649 if (res.ok) {
650 document.getElementById("tele-cortex").textContent = "COMMITTED (MANUAL)";
651 document.getElementById("receipt-area").textContent = `Manually committed entity: ${data.canonical_name}`;
652 } else {
653 alert("Commit error: " + (data.error || "Unknown"));
654 btn.disabled = false;
655 }
656 } catch (err) {
657 alert("Commit request failed: " + err.message);
658 btn.disabled = false;
659 }
660 });
661
662 loadModels();
663 </script>
664</body>
665</html>