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
aien-sovereign-core-mv / docs / campaigns / open-model-qwen3 / v4-rows.sh
| 1 | #!/usr/bin/env bash |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # OPEN-MODEL-QWEN3 v4 (ACCEPTANCE-v4.md Section 3, PREPARED, NOT FROZEN): the extra rows of one launch, computed |
| 18 | # from the run directory beside the v8 receipt. Shell + jq only. Usage: |
| 19 | # v4-rows.sh RUN_ROOT LAUNCH_ID TASKS.json OUT_DIR RECEIPT_BASENAME |
| 20 | # Writes OUT_DIR/<sha256 of content>.v4rows.json (never edited afterwards) and prints one scoring-v5 result line |
| 21 | # per row: {row: "<id>/<row>", rep: 1, verdict, receipt}. The saved file, the source file and the seed are hashed |
| 22 | # or read here, after the run, not taken from the runtime's own report. |
| 23 | set -eu |
| 24 | R=${1:?RUN_ROOT} ID=${2:?LAUNCH_ID} TASKS=${3:?TASKS} OUT=${4:?OUT_DIR} REC=${5:?RECEIPT} |
| 25 | HERE=$(cd "$(dirname "$0")" && pwd) |
| 26 | S=$R/steps |
| 27 | task=$(jq -c --arg id "$ID" '.tasks[] | select(.id == $id)' "$TASKS") |
| 28 | [ -n "$task" ] || { echo "v4-rows: launch $ID not in $TASKS" >&2; exit 4; } |
| 29 | j() { if [ -s "$1" ]; then jq -c . "$1" 2>/dev/null || echo null; else echo null; fi; } |
| 30 | ws=$(cd "$R/ws" && pwd -P) |
| 31 | committed='{"path_rel":null,"text":null,"file_sha256":null}' |
| 32 | s5p=$(jq -r '.path // empty' "$S/S5.json" 2>/dev/null || true) |
| 33 | if [ -n "$s5p" ] && [ -f "$s5p" ]; then |
| 34 | real=$(realpath -e "$s5p") |
| 35 | case "$real" in "$ws"/*) |
| 36 | committed=$(jq -n --arg p "${real#"$ws"/}" --rawfile t "$real" --arg h "$(sha256sum "$real" | cut -d' ' -f1)" \ |
| 37 | '{path_rel: $p, text: $t, file_sha256: $h}') ;; |
| 38 | esac |
| 39 | fi |
| 40 | seed_text=null |
| 41 | if [ "$(jq -r '.kind' <<<"$task")" = edit ]; then |
| 42 | sd=$(jq -r '.seed // empty' <<<"$task"); dest=$(jq -r '.destination // empty' <<<"$task") |
| 43 | [ -n "$sd" ] && [ -f "$HERE/$sd/$dest" ] && seed_text=$(jq -n --rawfile t "$HERE/$sd/$dest" '$t') |
| 44 | fi |
| 45 | source_now=null |
| 46 | sp=$(jq -r '.source.path // empty' <<<"$task") |
| 47 | if [ -n "$sp" ] && [ -f "$ws/$sp" ]; then |
| 48 | source_now=$(jq -n --arg p "$sp" --arg h "$(sha256sum "$ws/$sp" | cut -d' ' -f1)" '{path: $p, sha256: $h}') |
| 49 | fi |
| 50 | tmp=$(mktemp "$OUT/.v4rows.XXXXXX") |
| 51 | mods=$(cat "$HERE/rows-oq3-v3.jq" "$HERE/rows-oq3-v4.jq" | sha256sum | cut -d' ' -f1) |
| 52 | jq -L "$HERE" -n --argjson task "$task" --argjson report "$(j "$R/s3-report.json")" --argjson s5 "$(j "$S/S5.json")" \ |
| 53 | --argjson s8 "$(j "$S/S8.json")" --argjson committed "$committed" --argjson seed_text "$seed_text" --argjson source_now "$source_now" \ |
| 54 | --argjson run "$(j "$R/run.json")" --arg rec "$REC" --arg mod "$mods" \ |
| 55 | 'include "rows-oq3-v4"; |
| 56 | def j2: (try fromjson catch null); |
| 57 | {task: $task, daemon: ($run.daemon // null), report: $report, s5: ($s5 // {}), committed: $committed, seed_text: $seed_text, source_now: $source_now, |
| 58 | auths: (($s8.authorizations // []) | map((.text // "" | j2) + {id, verified}))} as $ev |
| 59 | | {launch: $task.id, receipt: $rec, rows_modules_sha256: $mod, rows: ($ev | v4_rows)}' >"$tmp" |
| 60 | h=$(sha256sum "$tmp" | cut -d' ' -f1) |
| 61 | mv "$tmp" "$OUT/$h.v4rows.json" |
| 62 | jq -c --arg id "$ID" --arg rec "$REC" --arg f "$h.v4rows.json" \ |
| 63 | '.rows[] | {row: ($id + "/" + .row), rep: 1, verdict: .result, receipt: $rec, extra_rows_file: $f}' "$OUT/$h.v4rows.json" |