Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/train/omega-llm/tools/controller/replay.sh # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / train / omega-llm / tools / controller / replay.sh` 74 lines ยท 3509 bytes Raw Blame History 1 #!/usr/bin/env bash 2 set -euo pipefail 3 cd "$(dirname "$0")" 4 src=$PWD 5 bin=$(realpath "${OUT:-../../../../build/omega-controller}") 6 omc=$(realpath "${OMC:-../../../../seed/out/omc}") 7 work=$(mktemp -d) 8 trap 'rm -rf "$work"' EXIT 9 cd "$work" 10 # The sampler can end immediately after the final identifier. 11 printf 'note multiply the arguments\nfn calc a ulong b ulong to ulong' >boundary-prompt 12 printf 'note multiply the arguments\nfn calc x ulong y ulong to ulong' >boundary-normalized 13 "$bin/normalize" boundary-prompt | cmp - boundary-normalized 14 for newline in no yes; do 15 printf 's = mul x y\nret mul s s\nend' >boundary-body 16 printf 's = mul a b\nret mul s s\nend' >boundary-expected 17 if [[ $newline == yes ]]; then printf '\n' >>boundary-body; printf '\n' >>boundary-expected; fi 18 "$bin/normalize" boundary-prompt boundary-body | cmp - boundary-expected 19 done 20 # Exercise real policy decisions using saved generator proposals. 21 cp "$src/example/prompt.om" prompt 22 cp "$src/example/example.om" first 23 cp "$src/example/second.om" second 24 cp "$src/example/answer.om" good 25 printf 'ret 0\nend\n' >wrong 26 controller=("$bin/controller" prompt "$omc" unused unused first unused unused "$bin/controller.ck") 27 "${controller[@]}" good wrong >answer 2>trace 28 cmp good answer 29 "${controller[@]}" unavailable unused one good wrong >answer 2>trace 30 cmp good answer 31 "${controller[@]}" second "$bin/second-augmented.ck" learned good wrong >answer 2>trace 32 cmp good answer 33 grep -q '^gate [0-7] 2$' trace 34 35 printf 'note choose the larger argument\nfn calc a ulong b ulong to ulong\n' >prompt 36 printf 'fn main to int\nif ne calc ulong 21 ulong 10 ulong 21\nret 83\nend\nret 77\nend\n' >first 37 printf 'fn main to int\nif ne calc ulong 14 ulong 23 ulong 23\nret 83\nend\nret 77\nend\n' >second 38 printf 'ret a\nend\n' >wrong 39 for mode in two learned; do 40 rc=0 41 "${controller[@]}" second "$bin/second-augmented.ck" "$mode" wrong wrong >answer 2>trace || rc=$? 42 test "$rc" -eq 3 43 test ! -s answer 44 grep -q '^gate 4 1$' trace 45 done 46 printf 'bad' >corrupt 47 rc=0 48 "${controller[@]}" second corrupt learned wrong wrong >answer 2>trace || rc=$? 49 test "$rc" -eq 72 50 test ! -s answer 51 52 for run in run-01 run-02; do 53 data="$src/$run" 54 for check in main first second; do 55 jq -c --arg k "$check" '.checks as $all | [.cases[] | {prompt,reference,main:$all[.checks][$k]}]' "$data/panel.json" >"$run-$check.json" 56 mkdir "$run-$check" 57 (cd "$run-$check" && "$bin/grade" "../$run-$check.json" "$omc" >grades) 58 test "$(awk '$2==2{n++} END{print n}' "$run-$check/grades")" -eq 80 59 done 60 for mode in $(jq -r 'keys[]' "$data/scores.json"); do 61 mkdir "$run-$mode" 62 (cd "$run-$mode" 63 jq -er --arg mode "$mode" '.[$mode] | select(length==80) | .[] | @base64' "$data/answers.json" | 64 { i=0; while IFS= read -r body; do printf '%s' "$body" | base64 -d >"answer-$i"; i=$((i+1)); done; test "$i" -eq 80; } 65 "$bin/grade" "../$run-main.json" "$omc" cached >actual 66 awk -F '\t' -v mode="$mode" '$1==mode{print $2, 2*$7+$8}' "$data/cases.tsv" >expected 67 cmp expected actual 68 for key in correct wrong abstained calls second_checks; do 69 sum=$(awk -F '\t' -v k="$key" -v m="$mode" 'NR==1{for(i=1;i<=NF;i++)if($i==k)col=i; if(!col)exit 1} $1==m{n+=$col} END{print n+0}' "$data/cases.tsv") 70 test "$sum" -eq "$(jq -er --arg m "$mode" --arg k "$key" '.[$m].all[$k]' "$data/scores.json")" 71 done) 72 done 73 done 74 echo "PASS: controller interfaces, 160 references on three checks each, and all 560 archived returns and abstentions."