aienos.com
Source of www.aienos.com, served from my own hardware
Brought by drakestapleton
aienos.com / public / js / terminal.js
| 1 | // AIEN OS Interactive Neural Terminal Micro-Script |
| 2 | // Pure Vanilla JavaScript (<2 KB) - Zero Virtual DOM overhead |
| 3 | |
| 4 | (function() { |
| 5 | const RESPONSES = { |
| 6 | sys_telemetry: { |
| 7 | device: "NVIDIA Grace Blackwell GB10", |
| 8 | compute_capability: "sm_121a", |
| 9 | unified_memory_total_gb: 128.0, |
| 10 | resident_kernel_model_gb: 64.3, |
| 11 | dynamic_kv_cache_allocated_gb: 4.8, |
| 12 | free_memory_gb: 58.9, |
| 13 | gpu_temp_celsius: 45.0, |
| 14 | power_draw_watts: 11.5, |
| 15 | performance_state: "P0 (Maximum Performance)" |
| 16 | }, |
| 17 | sys_alloc_kv: { |
| 18 | syscall: "sys_alloc_kv", |
| 19 | status: "SUCCESS", |
| 20 | blocks_requested: 2048, |
| 21 | block_size_tokens: 16, |
| 22 | bytes_allocated: 33554432, |
| 23 | alloc_duration_us: 1420, |
| 24 | fragmentation_ratio: 0.000, |
| 25 | page_table_mapping: "coherent_unified_sm_121a" |
| 26 | }, |
| 27 | sys_vault: { |
| 28 | subsystem: "atlas-vault", |
| 29 | hardware_key_substrate: "/dev/tpmrm0", |
| 30 | algorithm: "ECDSA P-256 (NIST SP 800-90A)", |
| 31 | disk_secrets_found: 0, |
| 32 | policy_status: "SECURE_TPM_ONLY", |
| 33 | memory_redaction_filter: "ACTIVE ([REDACTED_BY_ATLAS_VAULT])" |
| 34 | } |
| 35 | }; |
| 36 | |
| 37 | const HELP_TEXT = "Supported Neural Syscalls:\n sys_telemetry - Inspect GB10 thermals, power, and unified VRAM\n sys_alloc_kv - Allocate PagedAttention neural memory blocks\n sys_vault - Validate hardware TPM 2.0 key vault security\n clear - Clear terminal display"; |
| 38 | |
| 39 | function initTerminal() { |
| 40 | const output = document.getElementById("terminal-output"); |
| 41 | const input = document.getElementById("terminal-input"); |
| 42 | const form = document.getElementById("terminal-form"); |
| 43 | if (!output || !input || !form) return; |
| 44 | |
| 45 | function appendEntry(type, text) { |
| 46 | const line = document.createElement("div"); |
| 47 | line.className = "terminal-log-line " + type; |
| 48 | if (type === "cmd") { |
| 49 | line.innerHTML = '<span class="prompt-symbol">$ </span>' + escapeHtml(text); |
| 50 | } else if (type === "resp") { |
| 51 | line.innerHTML = '<pre class="terminal-resp">' + escapeHtml(text) + '</pre>'; |
| 52 | } else { |
| 53 | line.innerHTML = '<span class="sys-msg">' + escapeHtml(text) + '</span>'; |
| 54 | } |
| 55 | output.appendChild(line); |
| 56 | output.scrollTop = output.scrollHeight; |
| 57 | } |
| 58 | |
| 59 | function escapeHtml(str) { |
| 60 | return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); |
| 61 | } |
| 62 | |
| 63 | function runCommand(rawCmd) { |
| 64 | const cmd = rawCmd.trim(); |
| 65 | if (!cmd) return; |
| 66 | appendEntry("cmd", cmd); |
| 67 | |
| 68 | const normalized = cmd.toLowerCase(); |
| 69 | if (normalized === "clear") { |
| 70 | output.innerHTML = ""; |
| 71 | return; |
| 72 | } |
| 73 | if (normalized === "help") { |
| 74 | appendEntry("resp", HELP_TEXT); |
| 75 | return; |
| 76 | } |
| 77 | |
| 78 | let respKey = null; |
| 79 | if (normalized === "sys_telemetry" || normalized === "telemetry" || normalized === "status") { |
| 80 | respKey = "sys_telemetry"; |
| 81 | } else if (normalized === "sys_alloc_kv" || normalized === "alloc_kv") { |
| 82 | respKey = "sys_alloc_kv"; |
| 83 | } else if (normalized === "sys_vault" || normalized === "vault") { |
| 84 | respKey = "sys_vault"; |
| 85 | } |
| 86 | |
| 87 | if (respKey) { |
| 88 | appendEntry("resp", JSON.stringify(RESPONSES[respKey], null, 2)); |
| 89 | } else { |
| 90 | appendEntry("resp", "Unrecognized neural syscall: '" + cmd + "'. Type 'help' for supported syscalls."); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | form.addEventListener("submit", function(e) { |
| 95 | e.preventDefault(); |
| 96 | const val = input.value; |
| 97 | input.value = ""; |
| 98 | runCommand(val); |
| 99 | }); |
| 100 | |
| 101 | document.querySelectorAll("[data-cmd]").forEach(function(btn) { |
| 102 | btn.addEventListener("click", function() { |
| 103 | const cmd = btn.getAttribute("data-cmd"); |
| 104 | if (cmd) runCommand(cmd); |
| 105 | }); |
| 106 | }); |
| 107 | |
| 108 | const clearBtn = document.getElementById("terminal-clear-btn"); |
| 109 | if (clearBtn) { |
| 110 | clearBtn.addEventListener("click", function() { |
| 111 | output.innerHTML = ""; |
| 112 | }); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | if (document.readyState === "loading") { |
| 117 | document.addEventListener("DOMContentLoaded", initTerminal); |
| 118 | } else { |
| 119 | initTerminal(); |
| 120 | } |
| 121 | })(); |