aienos.com
Source of www.aienos.com, served from my own hardware
Brought by drakestapleton
aienos.com / om / lab-page / check.sh
| 1 | #!/bin/sh |
| 2 | # Host orchestration only. lab.om emits the /lab/ HTML, client.om emits lab.js and the run worker. |
| 3 | # Every captured byte (sources, compiler output, terminal transcripts) is escaped by Omega's emit. |
| 4 | set -eu |
| 5 | cd "$(dirname "$0")" |
| 6 | omc=${OMEGA_OMC:-../hive-page/omc} |
| 7 | pin=$(tr -d ' \n' < ../hive-page/omc.sha256) |
| 8 | [ "$(sha256sum "$omc" | cut -d' ' -f1)" = "$pin" ] || { echo 'Compiler pin mismatch' >&2; exit 3; } |
| 9 | work=$(mktemp -d) |
| 10 | trap 'rm -rf "$work"' EXIT HUP INT TERM |
| 11 | "$omc" < lab.om > "$work/page" |
| 12 | "$omc" < client.om > "$work/client" |
| 13 | chmod +x "$work/page" "$work/client" |
| 14 | # The take-home capture (captures/home.txt, fd 9) is no longer shown: its clone address closed with |
| 15 | # Radicle's removal on 2026-11-14. The file stays as the record of that run. |
| 16 | page() { |
| 17 | "$work/page" 3< axpy.om 6< captures/aarch64.txt 7< "$1" > "$2" |
| 18 | } |
| 19 | page captures/spirv.txt "$work/first.html" |
| 20 | page captures/spirv.txt "$work/second.html" |
| 21 | "$work/client" > "$work/first.js" 3> "$work/first-worker.js" |
| 22 | "$work/client" > "$work/second.js" 3> "$work/second-worker.js" |
| 23 | cmp "$work/first.html" "$work/second.html" |
| 24 | cmp "$work/first.js" "$work/second.js" |
| 25 | cmp "$work/first-worker.js" "$work/second-worker.js" |
| 26 | [ -s "$work/first.html" ] && [ -s "$work/first.js" ] && [ -s "$work/first-worker.js" ] |
| 27 | # Negative control: an empty capture must refuse, never publish a blank panel. |
| 28 | if page /dev/null "$work/refused.html"; then |
| 29 | echo 'Empty capture wrongly accepted' >&2; exit 5 |
| 30 | fi |
| 31 | stale=0 |
| 32 | publish() { |
| 33 | if [ ! -f "$2" ] || ! cmp -s "$1" "$2"; then stale=1; fi |
| 34 | cp "$1" "$2" |
| 35 | sha256sum "$2" > "$3" |
| 36 | } |
| 37 | publish "$work/first.html" main.html main.html.sha256 |
| 38 | publish "$work/first.js" ../../public/js/lab.js lab.js.sha256 |
| 39 | publish "$work/first-worker.js" ../../public/js/lab-worker.js lab-worker.js.sha256 |
| 40 | sha256sum ../../public/lab/axpy.wasm ../../public/lab/record.tsv > published.sha256 |
| 41 | if [ "$stale" = 1 ] && [ "${OMEGA_ACCEPT_CHANGE:-0}" != 1 ]; then |
| 42 | echo 'Artifacts changed; commit the generated files with their Omega sources' >&2; exit 4 |
| 43 | fi |
| 44 | printf 'LAB-GENERATED PASS compiler=%s\n' "$pin" |