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 / om / lab-page / check.sh

44 lines · 2069 bytes Raw Blame History
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.
4set -eu
5cd "$(dirname "$0")"
6omc=${OMEGA_OMC:-../hive-page/omc}
7pin=$(tr -d ' \n' < ../hive-page/omc.sha256)
8[ "$(sha256sum "$omc" | cut -d' ' -f1)" = "$pin" ] || { echo 'Compiler pin mismatch' >&2; exit 3; }
9work=$(mktemp -d)
10trap 'rm -rf "$work"' EXIT HUP INT TERM
11"$omc" < lab.om > "$work/page"
12"$omc" < client.om > "$work/client"
13chmod +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.
16page() {
17 "$work/page" 3< axpy.om 6< captures/aarch64.txt 7< "$1" > "$2"
18}
19page captures/spirv.txt "$work/first.html"
20page 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"
23cmp "$work/first.html" "$work/second.html"
24cmp "$work/first.js" "$work/second.js"
25cmp "$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.
28if page /dev/null "$work/refused.html"; then
29 echo 'Empty capture wrongly accepted' >&2; exit 5
30fi
31stale=0
32publish() {
33 if [ ! -f "$2" ] || ! cmp -s "$1" "$2"; then stale=1; fi
34 cp "$1" "$2"
35 sha256sum "$2" > "$3"
36}
37publish "$work/first.html" main.html main.html.sha256
38publish "$work/first.js" ../../public/js/lab.js lab.js.sha256
39publish "$work/first-worker.js" ../../public/js/lab-worker.js lab-worker.js.sha256
40sha256sum ../../public/lab/axpy.wasm ../../public/lab/record.tsv > published.sha256
41if [ "$stale" = 1 ] && [ "${OMEGA_ACCEPT_CHANGE:-0}" != 1 ]; then
42 echo 'Artifacts changed; commit the generated files with their Omega sources' >&2; exit 4
43fi
44printf 'LAB-GENERATED PASS compiler=%s\n' "$pin"