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/aien-sovereign-core-mv/blob/main/evidence/q36-readers-train/gate.sh # aien-sovereign-core-mv AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-sovereign-core-mv / evidence / q36-readers-train / gate.sh` 44 lines ยท 4107 bytes Raw Blame History 1 #!/bin/bash 2 # L371 eight readers on the merge train. Usage: gate.sh PORT OUT 3 # Exit 0 PASS, 1 FAIL (a check failed), 2 ERROR (no answer). Checks: 4 # 1 /v1/models lists -readers. 5 # 2 a short input on the readers id is the plain path: token ids == the same request on the plain id. 6 # 3 a long input (roadmap-excerpt.md, ~6k tokens) on the readers id: aien_readers with >= 2 parts, contiguous lines, 7 # (a part may start on the line the one before ended on: a very long line is cut at spaces), every part has notes, 8 # ${L371_READERS:-8} readers (the case needs that many free rows), and the final answer (content, not reasoning) joins 9 # two facts from far-apart parts: M0 is DOCTRINE_V1 (line 39) and the retired 28-milestone roadmap ended at 10 # SOVEREIGN_MACHINE_CLOSURE (line 121). Each name appears once in the excerpt. 11 # 4 red control: the same long input on the plain id carries no aien_readers (the check in 3 can tell). 12 set -uo pipefail 13 NR=${L371_READERS:-8} 14 P=$1; O=$2; H=$(cd "$(dirname "$0")"; pwd); mkdir -p "$O"; U=http://127.0.0.1:$P 15 fail() { echo "FAIL: $*"; exit 1; } 16 post() { curl -s --max-time 1800 -H 'Content-Type: application/json' --data-binary @"$1" "$U/v1/chat/completions" > "$2" || { echo "ERROR: no answer for $1"; exit 2; }; } 17 curl -s --max-time 30 "$U/v1/models" > "$O/models.json" || { echo "ERROR: /v1/models"; exit 2; } 18 M=$(jq -r '.data[0].id' "$O/models.json"); MR=$M-readers 19 jq -e --arg m "$MR" '[.data[].id] | index($m)' "$O/models.json" >/dev/null || fail "1: $MR not in /v1/models" 20 echo "PASS 1: $MR listed" 21 for m in "$M" "$MR"; do 22 jq -n --arg m "$m" '{model:$m, temperature:0, max_tokens:16, aien_return_token_ids:true, chat_template_kwargs:{enable_thinking:false}, messages:[{role:"user",content:"Say hello in five words."}]}' > "$O/short-$m.req" 23 post "$O/short-$m.req" "$O/short-$m.json" 24 done 25 a=$(jq -c .usage.aien_token_ids "$O/short-$M.json"); b=$(jq -c .usage.aien_token_ids "$O/short-$MR.json") 26 [ "$a" != null ] && [ "$a" = "$b" ] || fail "2: short input ids differ: plain $a readers $b" 27 jq -e '.aien_readers == null' "$O/short-$MR.json" >/dev/null || fail "2: short input went to the readers" 28 echo "PASS 2: short input on the readers id == plain ($a)" 29 for m in "$MR" "$M"; do 30 jq -n --arg m "$m" --rawfile doc "$H/roadmap-excerpt.md" '{model:$m, temperature:0, max_tokens:160, chat_template_kwargs:{enable_thinking:false}, messages:[{role:"user",content:($doc + "\n\nAnswer in two lines. (1) What is milestone M0 called? (2) Which milestone did the retired 28-milestone workstream roadmap end at? Give the names in capitals as written.")}]}' > "$O/long-$m.req" 31 t0=$(date +%s); post "$O/long-$m.req" "$O/long-$m.json"; echo "long $m: $(( $(date +%s) - t0 )) s" 32 done 33 R="$O/long-$MR.json" 34 jq -e '.aien_readers != null' "$R" >/dev/null || fail "3: no aien_readers on the long input: $(head -c 300 "$R")" 35 jq -e --argjson n "$NR" '.aien_readers.readers == $n and (.aien_readers.parts | length) == $n' "$R" >/dev/null \ 36 || fail "3: $(jq -r .aien_readers.readers "$R") readers, want $NR (were $NR rows free?)" 37 jq -e '.aien_readers.parts | (all(.[]; (.notes | length) > 0)) and ([range(1; length) as $i | ((.[$i].lines[0] - .[$i-1].lines[1]) as $d | $d == 0 or $d == 1)] | all)' "$R" >/dev/null \ 38 || fail "3: parts not contiguous or a part without notes" 39 A=$(jq -r '.choices[0].message.content // ""' "$R") 40 for f in DOCTRINE_V1 SOVEREIGN_MACHINE_CLOSURE; do grep -q "$f" <<<"$A" || fail "3: final answer misses $f: $(head -c 300 <<<"$A")"; done 41 echo "PASS 3: $(jq -r '.aien_readers.readers' "$R") readers, $(jq -r '.aien_readers.input_tokens' "$R") tokens, map $(jq -r '.aien_readers.map_ms' "$R") ms, answer joins DOCTRINE_V1 (part with line 39) and SOVEREIGN_MACHINE_CLOSURE (part with line 121)" 42 jq -e '.aien_readers == null' "$O/long-$M.json" >/dev/null || fail "4: the plain id read with readers" 43 jq -r '.choices[0].message.content' "$O/long-$M.json" | grep -q SOVEREIGN_MACHINE_CLOSURE || echo "note 4: plain answer misses SOVEREIGN_MACHINE_CLOSURE" 44 echo "PASS 4: the plain id has no aien_readers (red control: check 3 tells the two apart)"