interplane.Get Omega
Read in your language

aienos.com

Source of www.aienos.com, served from my own hardware

Brought by drakestapleton

branch main Branches Tags History

aienos.com / crates / site-builder / src / components / omega.rs

878 lines · 39311 bytes Raw Blame History
1//! /omega/: what Omega is, in the same words as the omega repository's
2//! `docs/OMEGA.md`.
3//!
4//! Omega is Aien's language for all computing, GPU to CPU.
5//! The page renders, from `data/omega.json`: the parts of Omega,
6//! its layer map and status, the dated work with its
7//! receipt, what is not true yet, and the bar C1 to C6 as a checklist.
8//! Every row links to its source or receipt on the forge. A row whose status
9//! is MISSING is drawn like any other row; nothing is filtered out.
10//!
11//! The data file is checked at build time: unknown status words, a bar row
12//! marked PASS without a receipt, a box that does not link to GitHub, a
13//! link in a form the expander does not know, or an em or en dash all fail
14//! the build and the tests.
15
16use std::sync::OnceLock;
17
18use maud::{html, Markup};
19use serde::Deserialize;
20
21use super::boxlink::{foot_labelled, Target};
22
23pub const TITLE: &str = "What Omega is | AienOS";
24pub const DESCRIPTION: &str = "Omega is Aien's language for all computing, GPU to CPU. Its layer map, dated measurements on DGX Spark GB10, receipts, current limits and acceptance checks.";
25pub const URL: &str = "https://www.aienos.com/omega/";
26
27/// The data file, compiled in and published as /omega.json.
28pub const RAW: &str = include_str!("../../data/omega.json");
29
30/// Omega on the forge. The repository aien-dev/omega was renamed to
31/// aien-dev/omega-mv; GitHub still redirects the old name, but the links
32/// name the repository as it is now.
33pub const OMEGA_BLOB: &str = "https://interplane.io/drakestapleton/omega-mv/blob/main/";
34pub const OMEGA_TREE: &str = "https://interplane.io/drakestapleton/omega-mv/tree/main/";
35
36/// Status words a layer row may carry, in the order the legend shows them.
37pub const STATUSES: [&str; 4] = ["PASS", "PARTIAL", "MISSING", "AS SHIPPED"];
38
39#[derive(Debug, Deserialize)]
40#[serde(deny_unknown_fields)]
41pub struct OmegaData {
42 pub source: Source,
43 pub claim: String,
44 pub claim_rest: Vec<String>,
45 pub true_today: String,
46 pub not_true_yet: String,
47 pub seed_birth: SeedBirth,
48 pub parts: Vec<Card>,
49 pub below: Card,
50 pub layers: Vec<Layer>,
51 pub receipt: Receipt,
52 pub not_yet: Vec<Gap>,
53 pub bar: Vec<Bar>,
54 pub beyond: Vec<Gap>,
55 pub performance: Performance,
56}
57
58/// The seed-born compiler walkthrough: eight stages, each pinned to an
59/// omega-mv commit with its own source box.
60#[derive(Debug, Deserialize)]
61#[serde(deny_unknown_fields)]
62pub struct SeedBirth {
63 pub text: Vec<String>,
64 pub steps: Vec<Step>,
65 pub limits: Vec<String>,
66 pub links: Vec<(String, String)>,
67}
68
69#[derive(Debug, Deserialize)]
70#[serde(deny_unknown_fields)]
71pub struct Step {
72 pub name: String,
73 pub what: String,
74 #[serde(rename = "box")]
75 pub box_: String,
76}
77
78#[derive(Debug, Deserialize)]
79#[serde(deny_unknown_fields)]
80pub struct Performance {
81 pub stand: String,
82 pub how: String,
83 pub links: Vec<(String, String)>,
84 #[serde(rename = "box")]
85 pub box_: String,
86 pub rule: String,
87 pub bar: Vec<Bar>,
88}
89
90#[derive(Debug, Deserialize)]
91#[serde(deny_unknown_fields)]
92pub struct Source {
93 pub doc: String,
94 pub branch: String,
95 pub commit: String,
96 pub checked: String,
97 pub ledger: String,
98 pub issue: String,
99}
100
101#[derive(Debug, Deserialize)]
102#[serde(deny_unknown_fields)]
103pub struct Card {
104 pub name: String,
105 pub what: String,
106 pub links: Vec<(String, String)>,
107 #[serde(rename = "box")]
108 pub box_: String,
109}
110
111#[derive(Debug, Deserialize)]
112#[serde(deny_unknown_fields)]
113pub struct Layer {
114 pub cuda: String,
115 pub job: String,
116 pub omega: String,
117 pub status: String,
118 pub note: String,
119 pub links: Vec<(String, String)>,
120 #[serde(rename = "box")]
121 pub box_: String,
122}
123
124#[derive(Debug, Deserialize)]
125#[serde(deny_unknown_fields)]
126pub struct Receipt {
127 pub title: String,
128 pub taken: String,
129 pub what: String,
130 pub facts: Vec<(String, String)>,
131 #[serde(rename = "box")]
132 pub box_: String,
133}
134
135#[derive(Debug, Deserialize)]
136#[serde(deny_unknown_fields)]
137pub struct Gap {
138 pub title: String,
139 pub text: String,
140 pub links: Vec<(String, String)>,
141 #[serde(rename = "box")]
142 pub box_: String,
143}
144
145#[derive(Debug, Deserialize)]
146#[serde(deny_unknown_fields)]
147pub struct Bar {
148 pub id: String,
149 pub title: String,
150 pub done_when: String,
151 pub status: String,
152 pub now: String,
153 pub receipt: Option<String>,
154 pub links: Vec<(String, String)>,
155}
156
157/// Expands a short link from the data file into a full address.
158/// `o:` a file in omega, `o/:` a folder in omega, `ob:` an omega branch,
159/// `om@:` an omega file at a full commit,
160/// `p:` physics, `c:` aien-sovereign-core, `c@:` an aien-sovereign-core file at a
161/// full commit, `c/:` an aien-sovereign-core folder at a full commit,
162/// `a:` aien-architecture, `b:` omega-bridge. Issues have no forge page and
163/// stay plain text. A link starting with `/` or `#` stays on this site.
164pub fn expand(link: &str) -> Result<String, String> {
165 const MAP: [(&str, &str); 10] = [
166 ("o/:", OMEGA_TREE),
167 ("om@:", "https://interplane.io/drakestapleton/omega-mv/blob/"),
168 ("ob:", "https://interplane.io/drakestapleton/omega-mv/tree/"),
169 ("o:", OMEGA_BLOB),
170 ("p:", "https://interplane.io/drakestapleton/physics-mv/blob/main/"),
171 ("c@:", "https://interplane.io/drakestapleton/aien-sovereign-core-mv/blob/"),
172 ("c/:", "https://interplane.io/drakestapleton/aien-sovereign-core-mv/tree/"),
173 ("c:", "https://interplane.io/drakestapleton/aien-sovereign-core-mv/blob/main/"),
174 ("a:", "https://interplane.io/drakestapleton/aien-architecture-mv/blob/main/"),
175 ("b:", "https://interplane.io/drakestapleton/omega-bridge/blob/main/"),
176 ];
177 if link.starts_with('/') || link.starts_with('#') {
178 return Ok(link.to_string());
179 }
180 for (prefix, base) in MAP {
181 if let Some(rest) = link.strip_prefix(prefix) {
182 if rest.is_empty() || rest.contains("..") || rest.contains(' ') {
183 return Err(format!("bad link {link:?}"));
184 }
185 return Ok(format!("{base}{rest}"));
186 }
187 }
188 Err(format!("unknown link form {link:?}"))
189}
190
191fn gh(link: &str) -> String {
192 let h = expand(link).unwrap_or_else(|e| panic!("data/omega.json: {e}"));
193 assert!(h.starts_with(super::boxlink::FORGE), "data/omega.json: box link must be on the forge: {link}");
194 h
195}
196
197pub fn parse(raw: &str) -> Result<OmegaData, String> {
198 serde_json::from_str(raw).map_err(|e| format!("data/omega.json does not parse: {e}"))
199}
200
201pub fn validate(d: &OmegaData) -> Result<(), String> {
202 if raw_has_dash(RAW) {
203 return Err("data/omega.json has an em or en dash".into());
204 }
205 let mut boxes: Vec<&str> = vec![&d.source.doc, &d.below.box_, &d.receipt.box_];
206 if !d.source.issue.strip_prefix("issue:").is_some_and(|n| !n.is_empty() && n.bytes().all(|b| b.is_ascii_digit())) {
207 return Err(format!("source.issue must be issue:<number>, got {:?}", d.source.issue));
208 }
209 if d.seed_birth.steps.len() != 8 {
210 return Err(format!("the seed walkthrough has {} steps, not 8", d.seed_birth.steps.len()));
211 }
212 for s in &d.seed_birth.steps {
213 let pin = s.box_.strip_prefix("om@:").ok_or_else(|| format!("seed step box must be pinned om@: {}", s.box_))?;
214 if pin.len() < 42 || !pin.as_bytes()[..40].iter().all(u8::is_ascii_hexdigit) || pin.as_bytes()[40] != b'/' {
215 return Err(format!("seed step box must name a full commit: {}", s.box_));
216 }
217 boxes.push(&s.box_);
218 }
219 let mut links: Vec<&str> = d.seed_birth.links.iter().map(|l| l.1.as_str()).collect();
220 for c in &d.parts {
221 boxes.push(&c.box_);
222 links.extend(c.links.iter().map(|l| l.1.as_str()));
223 }
224 links.extend(d.below.links.iter().map(|l| l.1.as_str()));
225 if d.layers.len() < 13 {
226 return Err(format!("the Omega layer map has {} rows; 13 are required", d.layers.len()));
227 }
228 for l in &d.layers {
229 if !STATUSES.contains(&l.status.as_str()) {
230 return Err(format!("unknown status {:?} on {}", l.status, l.cuda));
231 }
232 if l.cuda.is_empty() || l.omega.is_empty() || l.job.is_empty() {
233 return Err(format!("empty cell in the Omega layer map row {:?}", l.cuda));
234 }
235 boxes.push(&l.box_);
236 links.extend(l.links.iter().map(|x| x.1.as_str()));
237 }
238 for g in d.not_yet.iter().chain(d.beyond.iter()) {
239 boxes.push(&g.box_);
240 links.extend(g.links.iter().map(|x| x.1.as_str()));
241 }
242 let ids: Vec<&str> = d.bar.iter().map(|b| b.id.as_str()).collect();
243 if ids != ["C1", "C2", "C3", "C4", "C5", "C6"] {
244 return Err(format!("the bar must be C1 to C6 in order, found {ids:?}"));
245 }
246 let pids: Vec<&str> = d.performance.bar.iter().map(|b| b.id.as_str()).collect();
247 if pids != ["P0", "P1", "P2", "P3", "P4"] {
248 return Err(format!("the performance bar must be P0 to P4 in order, found {pids:?}"));
249 }
250 boxes.push(&d.performance.box_);
251 links.extend(d.performance.links.iter().map(|x| x.1.as_str()));
252 for b in d.bar.iter().chain(d.performance.bar.iter()) {
253 if !STATUSES[..3].contains(&b.status.as_str()) {
254 return Err(format!("{}: unknown status {:?}", b.id, b.status));
255 }
256 match (&b.status[..], &b.receipt) {
257 ("PASS", None) => return Err(format!("{} is PASS without a receipt", b.id)),
258 ("PASS", Some(r)) if !r.starts_with("o:evidence/") && !r.starts_with("o/:evidence/") => {
259 return Err(format!("{} receipt must be under omega evidence/: {r}", b.id))
260 }
261 (s, Some(_)) if s != "PASS" => return Err(format!("{} has a receipt but is {s}", b.id)),
262 _ => {}
263 }
264 if let Some(r) = &b.receipt {
265 boxes.push(r);
266 }
267 links.extend(b.links.iter().map(|x| x.1.as_str()));
268 }
269 for b in boxes {
270 let h = expand(b)?;
271 if !h.starts_with(super::boxlink::FORGE) {
272 return Err(format!("box link off the forge: {b}"));
273 }
274 }
275 for l in links {
276 expand(l)?;
277 }
278 if !d.source.doc.starts_with("o:docs/OMEGA.md") {
279 return Err("source.doc must be omega docs/OMEGA.md".into());
280 }
281 Ok(())
282}
283
284fn raw_has_dash(s: &str) -> bool {
285 s.contains('\u{2014}') || s.contains('\u{2013}')
286}
287
288pub fn data() -> &'static OmegaData {
289 static DATA: OnceLock<OmegaData> = OnceLock::new();
290 DATA.get_or_init(|| {
291 let d = parse(RAW).unwrap_or_else(|e| panic!("{e}"));
292 validate(&d).unwrap_or_else(|e| panic!("data/omega.json: {e}"));
293 d
294 })
295}
296
297fn status_class(s: &str) -> &'static str {
298 match s {
299 "PASS" => "om-pass",
300 "PARTIAL" => "om-partial",
301 "MISSING" => "om-missing",
302 _ => "om-fixed",
303 }
304}
305
306fn status_label(s: &str) -> &'static str {
307 match s {
308 "PASS" => "PASS",
309 "PARTIAL" => "PARTIAL",
310 "MISSING" => "MISSING",
311 _ => "AS SHIPPED",
312 }
313}
314
315/// Inline links inside a box; they sit above the box's stretched link.
316fn inline_links(links: &[(String, String)]) -> Markup {
317 html! {
318 @if !links.is_empty() {
319 ul class="om-links" {
320 @for (label, link) in links {
321 @let h = expand(link).unwrap_or_else(|e| panic!("{e}"));
322 li {
323 @if h.starts_with("https://") {
324 a href=(h) target="_blank" rel="noopener noreferrer" { (label) }
325 } @else {
326 a href=(h) { (label) }
327 }
328 }
329 }
330 }
331 }
332 }
333}
334
335/// The label of a box link: a receipt in evidence/ is evidence, anything
336/// else is the source file that holds the text.
337fn box_foot(link: &str) -> Markup {
338 let h = gh(link);
339 let evidence = link.contains("evidence/");
340 if evidence {
341 foot_labelled(&h, "Receipt on the forge", Target::Evidence)
342 } else {
343 foot_labelled(&h, "Source on the forge", Target::Source)
344 }
345}
346
347/// Counts of each status word in the Omega layer map, in legend order.
348pub fn layer_counts(d: &OmegaData) -> Vec<(&'static str, usize)> {
349 STATUSES.iter().map(|s| (*s, d.layers.iter().filter(|l| l.status == *s).count())).collect()
350}
351
352pub fn bar_met(d: &OmegaData) -> usize {
353 d.bar.iter().filter(|b| b.status == "PASS").count()
354}
355
356pub fn render_omega_page() -> Markup {
357 let d = data();
358 let doc = gh(&d.source.doc);
359 let counts = layer_counts(d);
360 let met = bar_met(d);
361 let pmet = d.performance.bar.iter().filter(|b| b.status == "PASS").count();
362 html! {
363 div class="om-page" {
364 header class="om-hero" {
365 div class="container" {
366 p class="om-kicker" { "Omega" }
367 h1 class="om-title" { (d.claim) }
368 @for p in &d.claim_rest {
369 p class="om-lead" { (p) }
370 }
371 div class="om-verdicts" {
372 div class="om-verdict om-verdict-true" {
373 p class="om-verdict-k" { "True today, with a receipt" }
374 p class="om-verdict-s" { (d.true_today) }
375 a class="om-verdict-a" href="#today" { "See the receipt" }
376 }
377 div class="om-verdict om-verdict-not" {
378 p class="om-verdict-k" { "Not true yet" }
379 p class="om-verdict-s" { "\u{201C}" (d.not_true_yet) "\u{201D}" }
380 a class="om-verdict-a" href="#bar" { (met) " of " (d.bar.len()) " checks met" }
381 }
382 }
383 p class="om-source" {
384 "Written from "
385 a href=(doc) target="_blank" rel="noopener noreferrer" { "docs/OMEGA.md" }
386 " in the omega repository (branch " span class="mono" { (d.source.branch) } " at "
387 span class="mono" { (d.source.commit) } "), checked " (d.source.checked) ". Status words: PASS (a receipt exists on the named commit), PARTIAL, MISSING. Ledger item "
388 a href=(format!("/now/#{}", d.source.ledger)) { (d.source.ledger) }
389 " tracks the work; tracking issue "
390 code { "omega#" (d.source.issue.trim_start_matches("issue:")) }
391 ". Data file: "
392 a href="/omega.json" { "/omega.json" }
393 "."
394 }
395 nav class="om-toc" aria-label="On this page" {
396 a href="#seed-birth" { "How I made the language" }
397 a href="#parts" { "The parts" }
398 a href="#cuda-map" { "Omega's layer map" }
399 a href="#today" { "True today" }
400 a href="#not-yet" { "Not true yet" }
401 a href="#bar" { "The bar, C1 to C6" }
402 a href="#beyond" { "More Omega work" }
403 a href="#performance" { "Performance" }
404 }
405 p class="om-source" {
406 "CUDA++, the GPU half of Omega, has its own page: "
407 a href="/cudaplusplus/" { "CUDA++" }
408 "."
409 }
410 p class="om-source" {
411 "Writing Omega yourself, or pointing an agent at it: the "
412 a href="/omega/reference/" { "Omega language reference" }
413 " has every compiler error, every trap and every gated worked example."
414 }
415 }
416 }
417
418 section id="seed-birth" class="om-section" {
419 div class="container" {
420 p class="om-kicker" { "How I made the language" }
421 h2 class="om-h2" { "How I made the language, from instruction words to a compiler written in Omega" }
422 @for p in &d.seed_birth.text {
423 p class="om-sub" { (p) }
424 }
425 div class="om-parts" {
426 @for s in &d.seed_birth.steps {
427 article class="om-part" {
428 h3 class="om-part-name" { (s.name) }
429 p class="om-part-what" { (s.what) }
430 (box_foot(&s.box_))
431 }
432 }
433 }
434 @for p in &d.seed_birth.limits {
435 p class="om-sub" { (p) }
436 }
437 (inline_links(&d.seed_birth.links))
438 }
439 }
440
441 section id="parts" class="om-section" {
442 div class="container" {
443 p class="om-kicker" { "1 \u{00B7} The parts" }
444 h2 class="om-h2" { "Four parts, and the driver below them" }
445 div class="om-parts" {
446 @for c in &d.parts {
447 article class="om-part" {
448 h3 class="om-part-name" { (c.name) }
449 p class="om-part-what" { (c.what) }
450 (inline_links(&c.links))
451 (box_foot(&c.box_))
452 }
453 }
454 }
455 article class="om-part om-below" {
456 h3 class="om-part-name" { (d.below.name) }
457 p class="om-part-what" { (d.below.what) }
458 (inline_links(&d.below.links))
459 (box_foot(&d.below.box_))
460 }
461 }
462 }
463
464 section id="cuda-map" class="om-section" {
465 div class="container" {
466 p class="om-kicker" { "2 \u{00B7} Omega's layer map" }
467 h2 class="om-h2" { "Omega's layer map" }
468 p class="om-sub" {
469 "The layers run from the language to the chip. Each row describes the work at that layer. Missing pieces are shown as missing."
470 }
471 div class="om-meter" role="img" aria-label=(meter_label(&counts)) {
472 @for l in &d.layers {
473 span class=(format!("om-seg {}", status_class(&l.status))) title=(format!("{}: {}", l.cuda, status_label(&l.status))) {}
474 }
475 }
476 ul class="om-legend" {
477 @for (s, n) in &counts {
478 li class=(status_class(s)) { span class="om-dot" aria-hidden="true" {} (s) " " span class="mono" { (n) } }
479 }
480 }
481 div class="om-map" role="table" aria-label="Omega layers and their implementation" {
482 div class="om-map-head" role="row" {
483 span role="columnheader" { "Layer" }
484 span role="columnheader" { "Its job" }
485 span role="columnheader" { "Implementation" }
486 span role="columnheader" { "Status" }
487 }
488 @for l in &d.layers {
489 div class=(format!("om-layer {}", status_class(&l.status))) role="row" {
490 span class="om-cuda" role="cell" { (l.cuda) }
491 span class="om-job" role="cell" { (l.job) }
492 span class="om-repl" role="cell" {
493 (l.omega)
494 (inline_links(&l.links))
495 }
496 span class="om-status" role="cell" {
497 span class="om-pill" { (status_label(&l.status)) }
498 @if !l.note.is_empty() { span class="om-note" { (l.note) } }
499 }
500 (box_foot(&l.box_))
501 }
502 }
503 }
504 }
505 }
506
507 section id="today" class="om-section" {
508 div class="container" {
509 p class="om-kicker" { "What is already true, with a receipt" }
510 h2 class="om-h2" { (d.receipt.title) }
511 article class="om-receipt" {
512 p class="om-receipt-what" { (d.receipt.what) }
513 dl class="om-facts" {
514 @for (k, v) in &d.receipt.facts {
515 div class=(if v == "0" { "om-fact om-fact-zero" } else { "om-fact" }) {
516 dt { (k) }
517 dd class="mono" { (v) }
518 }
519 }
520 }
521 p class="om-taken" { "Taken " span class="mono" { (d.receipt.taken) } ". The receipt holds the binary sha256, the mapped libraries, ldd, the driver version and the commands used." }
522 p class="om-true" { "So this sentence is true today: " strong { (d.true_today) } }
523 (box_foot(&d.receipt.box_))
524 }
525 }
526 }
527
528 section id="not-yet" class="om-section" {
529 div class="container" {
530 p class="om-kicker" { "What is not true yet" }
531 h2 class="om-h2" { "\u{201C}" (d.not_true_yet) "\u{201D} is not true yet" }
532 div class="om-gaps" {
533 @for g in &d.not_yet {
534 article class="om-gap" {
535 h3 class="om-gap-title" { (g.title) }
536 p { (g.text) }
537 (inline_links(&g.links))
538 (box_foot(&g.box_))
539 }
540 }
541 }
542 }
543 }
544
545 section id="bar" class="om-section" {
546 div class="container" {
547 p class="om-kicker" { "3 \u{00B7} GPU acceptance checks" }
548 h2 class="om-h2" { (met) " of " (d.bar.len()) " met" }
549 p class="om-sub" {
550 "I say it when every row is PASS, each with a receipt pushed on the exact commit. No row is waived. A row is ticked here only when its receipt is in the data file; until then it shows where it stands on the layer map above."
551 }
552 (bar_list(&d.bar, "o:docs/OMEGA.md#3-the-bar-for-omega-replaces-cuda"))
553 }
554 }
555
556 section id="beyond" class="om-section" {
557 div class="container" {
558 p class="om-kicker" { "4 \u{00B7} More Omega work" }
559 h2 class="om-h2" { "Runtime, driver and host work" }
560 p class="om-sub" { "The runtime, driver and host bindings each have their own acceptance checks." }
561 div class="om-gaps" {
562 @for g in &d.beyond {
563 article class="om-beyond" {
564 h3 class="om-gap-title" { (g.title) }
565 p { (g.text) }
566 (inline_links(&g.links))
567 (box_foot(&g.box_))
568 }
569 }
570 }
571 }
572
573 section id="performance" class="om-section" {
574 div class="container" {
575 p class="om-kicker" { "5 \u{00B7} Performance: what has been measured" }
576 h2 class="om-h2" { (pmet) " of " (d.performance.bar.len()) " met" }
577 article class="om-gap om-perf" {
578 p { (d.performance.stand) }
579 p { (d.performance.how) }
580 (inline_links(&d.performance.links))
581 (box_foot(&d.performance.box_))
582 }
583 p class="om-sub om-perf-rule" { (d.performance.rule) }
584 (bar_list(&d.performance.bar, &d.performance.box_))
585 }
586 }
587 }
588 }
589 }
590}
591
592/// A bar as a checklist: a row is ticked only when its receipt is in the data file.
593fn bar_list(bar: &[Bar], fallback: &str) -> Markup {
594 html! {
595 ol class="om-bar" {
596 @for b in bar {
597 @let done = b.status == "PASS";
598 li class=(format!("om-bar-row {}", if done { "om-done" } else { "om-open" })) id=(b.id.to_ascii_lowercase()) {
599 span class="om-check" aria-hidden="true" { @if done { "\u{2713}" } }
600 div class="om-bar-body" {
601 h3 class="om-bar-title" {
602 span class="om-bar-id mono" { (b.id) }
603 " " (b.title)
604 span class=(format!("om-pill {}", status_class(&b.status))) { @if done { "MET" } @else { "OPEN \u{00B7} " (b.status) } }
605 }
606 p class="om-bar-when" { strong { "Done when: " } (b.done_when) }
607 @if !b.now.is_empty() {
608 p class="om-bar-now" { strong { "Now: " } (b.now) }
609 }
610 (inline_links(&b.links))
611 @match &b.receipt {
612 Some(r) => { (box_foot(r)) }
613 None => { (box_foot(fallback)) }
614 }
615 }
616 }
617 }
618 }
619 }
620}
621
622fn meter_label(counts: &[(&str, usize)]) -> String {
623 let parts: Vec<String> = counts.iter().map(|(s, n)| format!("{n} {s}")).collect();
624 format!("The Omega layer map: {}", parts.join(", "))
625}
626
627/// Renders `text` with its first standalone "Omega" linked to /omega/.
628/// Used wherever the site names Omega in running text.
629pub fn link_first(text: &str) -> Markup {
630 let bytes = text.as_bytes();
631 let mut from = 0;
632 while let Some(off) = text[from..].find("Omega") {
633 let i = from + off;
634 let j = i + "Omega".len();
635 let before_ok = i == 0 || !bytes[i - 1].is_ascii_alphanumeric();
636 let after_ok = j == text.len() || !bytes[j].is_ascii_alphanumeric();
637 if before_ok && after_ok {
638 return html! { (&text[..i]) a class="omega-link" href="/omega/" { "Omega" } (&text[j..]) };
639 }
640 from = j;
641 }
642 html! { (text) }
643}
644
645#[cfg(test)]
646mod tests {
647 use super::*;
648 use crate::components::boxlink::check_boxes;
649
650 #[test]
651 fn data_parses_and_validates() {
652 let d = parse(RAW).unwrap();
653 validate(&d).unwrap();
654 assert_eq!(d.claim, "Omega is Aien's language for all computing, GPU to CPU.");
655 assert_eq!(d.layers.len(), 13);
656 assert_eq!(d.bar.len(), 6);
657 }
658
659 #[test]
660 fn page_says_what_omega_is_first() {
661 let s = render_omega_page().into_string();
662 let h1 = s.find("<h1").unwrap();
663 assert!(s[h1..].starts_with("<h1 class=\"om-title\">Omega is Aien&#39;s language for all computing, GPU to CPU.</h1>") || s[h1..].starts_with("<h1 class=\"om-title\">Omega is Aien's language for all computing, GPU to CPU.</h1>"), "{}", &s[h1..h1 + 120]);
664 assert!(s.contains("Omega does not yet cover every GPU layer above the kernel driver"));
665 assert_eq!(s.matches("<h1").count(), 1);
666 }
667
668 #[test]
669 fn missing_rows_are_shown_not_hidden() {
670 let d = data();
671 let s = render_omega_page().into_string();
672 for l in &d.layers {
673 assert!(s.contains(&format!("<span class=\"om-cuda\" role=\"cell\">{}</span>", l.cuda)), "row {} not rendered", l.cuda);
674 }
675 let missing = d.layers.iter().filter(|l| l.status == "MISSING").count();
676 assert!(missing >= 1);
677 assert_eq!(s.matches("om-layer om-missing").count(), missing);
678 assert_eq!(s.matches("class=\"om-seg ").count(), d.layers.len());
679 }
680
681 #[test]
682 fn every_box_links_to_the_forge() {
683 let s = render_omega_page().into_string();
684 let n = check_boxes(&s).unwrap();
685 let d = data();
686 assert_eq!(n, d.seed_birth.steps.len() + d.parts.len() + 1 + d.layers.len() + 1 + d.not_yet.len() + d.bar.len() + d.beyond.len() + 1 + d.performance.bar.len());
687 assert!(s.contains("https://interplane.io/drakestapleton/omega-mv/blob/main/evidence/WHAT-OMEGA-IS-20261021/live-serve-no-cuda.txt"));
688 assert!(s.contains("https://interplane.io/drakestapleton/omega-mv/blob/main/docs/OMEGA.md"));
689 assert!(!s.contains("https://github.com/aien-dev/omega/"));
690 }
691
692 #[test]
693 fn seed_walkthrough_has_eight_pinned_stages_and_honest_limits() {
694 let s = render_omega_page().into_string();
695 assert!(s.contains("id=\"seed-birth\"") && s.contains("href=\"#seed-birth\""));
696 let d = data();
697 assert_eq!(d.seed_birth.steps.len(), 8);
698 for st in &d.seed_birth.steps {
699 let pinned = st.box_.strip_prefix("om@:").unwrap();
700 assert!(s.contains(&format!("https://interplane.io/drakestapleton/omega-mv/blob/{pinned}")), "stage {} has no pinned source box", st.name);
701 }
702 for phrase in ["408 bytes", "AI coding agents", "host shell", "not yet retired", "not a proof of correctness", "29b12760", "191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9", "aca00cf3677236809f0f223437398c6bb429e4c65f13d58762bcf96d13799474"] {
703 assert!(s.contains(phrase), "missing provenance or limit {phrase}");
704 }
705 assert!(!s.contains("On the CPU, it replaces C and its toolchain."));
706 }
707
708 #[test]
709 fn seed_step_boxes_must_name_a_full_commit() {
710 let mut d = parse(RAW).unwrap();
711 d.seed_birth.steps[0].box_ = "o:seed/rung0/seed0.hex".into();
712 assert!(validate(&d).unwrap_err().contains("pinned"));
713 let mut d = parse(RAW).unwrap();
714 d.seed_birth.steps[0].box_ = "om@:29b12760/seed/rung0/seed0.hex".into();
715 assert!(validate(&d).unwrap_err().contains("full commit"));
716 let mut d = parse(RAW).unwrap();
717 d.seed_birth.steps.pop();
718 assert!(validate(&d).unwrap_err().contains("not 8"));
719 }
720
721 #[test]
722 fn bar_is_an_honest_checklist() {
723 let s = render_omega_page().into_string();
724 let d = data();
725 let met = bar_met(d);
726 let pmet = d.performance.bar.iter().filter(|b| b.status == "PASS").count();
727 assert_eq!(s.matches("om-bar-row om-done").count(), met + pmet);
728 assert_eq!(s.matches("om-bar-row om-open").count(), 6 - met + 5 - pmet);
729 assert!(s.contains(&format!("{met} of 6 met")));
730 for id in ["c1", "c2", "c3", "c4", "c5", "c6", "p0", "p1", "p2", "p3", "p4"] {
731 assert!(s.contains(&format!("id=\"{id}\"")), "{id}");
732 }
733 }
734
735 #[test]
736 fn a_pass_without_receipt_is_refused() {
737 let mut d = parse(RAW).unwrap();
738 d.bar[0].status = "PASS".into();
739 assert!(validate(&d).unwrap_err().contains("PASS without a receipt"));
740 d.bar[0].receipt = Some("o:docs/OMEGA.md".into());
741 assert!(validate(&d).unwrap_err().contains("under omega evidence/"));
742 let mut d = parse(RAW).unwrap();
743 d.performance.bar[0].receipt = Some("o:evidence/x".into());
744 assert!(validate(&d).unwrap_err().contains("has a receipt but is MISSING"));
745 }
746
747 #[test]
748 fn unknown_status_and_off_github_box_are_refused() {
749 let d = parse(&RAW.replacen("\"status\": \"PARTIAL\"", "\"status\": \"ALMOST\"", 1)).unwrap();
750 assert!(validate(&d).unwrap_err().contains("unknown status"));
751 let d = parse(&RAW.replacen("\"box\": \"o/:evidence/E1-CLOSURE\"", "\"box\": \"/now/\"", 1)).unwrap();
752 assert!(validate(&d).unwrap_err().contains("off the forge"));
753 assert!(expand("x:foo").is_err());
754 assert!(expand("o:../etc").is_err());
755 }
756
757 #[test]
758 fn link_expansion() {
759 assert_eq!(expand("o:docs/OMEGA.md").unwrap(), "https://interplane.io/drakestapleton/omega-mv/blob/main/docs/OMEGA.md");
760 assert_eq!(expand("o/:src/checker2").unwrap(), "https://interplane.io/drakestapleton/omega-mv/tree/main/src/checker2");
761 assert_eq!(expand("ob:runtime/r2-hello").unwrap(), "https://interplane.io/drakestapleton/omega-mv/tree/runtime/r2-hello");
762 assert_eq!(expand("/now/#L332").unwrap(), "/now/#L332");
763 assert_eq!(expand("c@:abc/docs/x.md").unwrap(), "https://interplane.io/drakestapleton/aien-sovereign-core-mv/blob/abc/docs/x.md");
764 assert_eq!(expand("c/:abc/evidence/x").unwrap(), "https://interplane.io/drakestapleton/aien-sovereign-core-mv/tree/abc/evidence/x");
765 assert!(expand("issue:593").is_err(), "issues stay plain text");
766 }
767
768 #[test]
769 fn link_first_links_only_the_word() {
770 assert_eq!(
771 link_first("Aien proposes. Omega checks. Omega again.").into_string(),
772 "Aien proposes. <a class=\"omega-link\" href=\"/omega/\">Omega</a> checks. Omega again."
773 );
774 assert_eq!(link_first("Omegese only").into_string(), "Omegese only");
775 assert_eq!(link_first("Omega's tools").into_string(), "<a class=\"omega-link\" href=\"/omega/\">Omega</a>&#39;s tools".replace("&#39;", "'"));
776 }
777
778 #[test]
779 fn no_dashes_and_plain_words() {
780 let s = render_omega_page().into_string();
781 assert!(!s.contains('\u{2014}') && !s.contains('\u{2013}'));
782 let lower = s.to_ascii_lowercase();
783 for w in ["revolutionary", "blazing", "cutting-edge", "seamless", "world-class", "powerful", "aienix"] {
784 assert!(!lower.contains(w), "{w}");
785 }
786 }
787
788 #[test]
789 fn performance_bars_require_recorded_measurements() {
790 let d = data();
791 for id in ["P1", "P2", "P3"] {
792 let bar = d.performance.bar.iter().find(|b| b.id == id).expect(id);
793 assert!(
794 bar.done_when.contains("is measured") && bar.done_when.contains("three runs") && bar.done_when.contains("table and logs pushed"),
795 "{id} must require recorded measurements: {}",
796 bar.done_when
797 );
798 let lower = bar.done_when.to_ascii_lowercase();
799 assert!(!lower.contains("or past"), "{id} would let a tie pass");
800 assert!(!lower.contains("at the best"), "{id} would let a tie pass");
801 }
802 }
803
804 #[test]
805 fn speed_is_measured_only_never_compared() {
806 // The page states what was measured, keeps chip time apart from end
807 // to end, and does not say Omega the language runs the model.
808 // Overclaims stay banned. A comparison claim ("level with", "ahead
809 // of", "faster than") may appear only in a sentence that is dated
810 // and backed by a receipt or the other project's published numbers.
811 let s = render_omega_page().into_string();
812 let lower = s.to_ascii_lowercase();
813 for w in ["beating cuda", "matching and then", "runs on omega", "omega runs"] {
814 assert!(!lower.contains(w), "{w}");
815 }
816 // The complete page stays subject to the comparison checker.
817 let problems = crate::components::machines::comparison_errors_at("omega/index.html", &s);
818 assert!(problems.is_empty(), "live sentences: {problems:?}");
819 assert!(!crate::components::machines::is_prose_exempt("crates/site-builder/data/omega.json"));
820 assert!(!crate::components::machines::is_prose_exempt("omega/index.html"));
821 assert!(crate::components::machines::comparison_problem("2x faster than llama.cpp").unwrap().contains("unsourced"));
822 assert!(crate::components::machines::comparison_problem(
823 "On 2026-10-21 this run was faster than llama.cpp's published 40 tok/s (https://example.com/bench)."
824 ).is_some());
825 assert!(crate::components::machines::comparison_problem(
826 "On 2026-10-21 this run was faster than llama.cpp's published 40 tok/s (https://interplane.io/drakestapleton/sovereign-intelligence)."
827 ).is_none());
828 let overclaim = format!(
829 "A {}, dated 2026-10-21, receipt https://example.com/r.",
830 concat!("replacement for ", "CUDA")
831 );
832 assert!(crate::components::machines::comparison_problem(&overclaim).unwrap().contains("overclaim"));
833 let d = data();
834 assert!(d.performance.stand.contains("end to end") && d.performance.stand.contains("chip time"));
835 assert!(d.performance.stand.contains("20.7 ms") && d.performance.stand.contains("48.31"));
836 assert!(!d.performance.stand.contains("20.1") && !d.performance.stand.contains("49.8"));
837 assert!(!d.performance.stand.to_ascii_lowercase().contains("leaves out the server"));
838 assert!(d.performance.stand.contains("prompt reading"));
839 assert!(d.performance.stand.contains("test server") && d.performance.stand.contains("branch build"));
840 assert!(d.performance.stand.contains("about 3B parameters active per token"));
841 assert!(d.true_today.contains("C GPU stack") && d.true_today.contains("bar C1"));
842 assert!(s.contains("https://interplane.io/drakestapleton/aien-sovereign-core-mv/tree/9c62690a252ab1c0b75eb8933c550316b5c50d52/evidence/q36-batch-20261021"));
843 // The same phrases are refused in the sources that used to state them,
844 // not only in the rendered /omega/ page.
845 assert_no_parity("/omega/", &s);
846 for (name, text) in [
847 ("matrix.rs", include_str!("matrix.rs")),
848 ("facts.rs", include_str!("../facts.rs")),
849 ("omega.json", RAW),
850 ("cudaplusplus.json", include_str!("../../data/cudaplusplus.json")),
851 ("cudaplusplus.rs", include_str!("cudaplusplus.rs")),
852 ("seo.rs", include_str!("../seo.rs")),
853 ("main.rs", include_str!("../main.rs")),
854 ("omega.rs", include_str!("omega.rs")),
855 ("research/index.html", include_str!("../../../../public/research/index.html")),
856 ("research/omega-language/index.html", include_str!("../../../../public/research/omega-language/index.html")),
857 ("engineer.json", include_str!("../../../../public/data/engineer.json")),
858 ] {
859 assert_no_parity(name, text);
860 }
861 }
862
863 /// Phrases split so this file can be scanned without matching itself.
864 fn parity_phrases() -> [&'static str; 3] {
865 [
866 concat!("replacement for ", "CUDA"),
867 concat!("everything ", "CUDA gives you"),
868 concat!("Omega's replacement and ", "its status"),
869 ]
870 }
871
872 fn assert_no_parity(name: &str, text: &str) {
873 let lower = text.to_ascii_lowercase();
874 for w in parity_phrases() {
875 assert!(!lower.contains(&w.to_ascii_lowercase()), "{name} contains {w}");
876 }
877 }
878}