interplane.Get Omega
Read in your language

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

branch main Branches Tags History

aien-sovereign-core-mv / docs / campaigns / next-phase-1 / run-v8.sh

91 lines · 5820 bytes Raw Blame History
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# NEXT-PHASE-1 v8 campaign (ACCEPTANCE-v8.md): run-v7.sh with the v8 wiring of
18# ACCEPTANCE-v8 Section 6 and nothing else. The seven launches of tasks-v8.json
19# (T4 T5 T6 T7 N1 N2 R1, ACCEPTANCE-v8 Section 3), same
20# goals, max_tokens, T5 seed and CPU reference run; each receipt is built by
21# make-receipt.sh with V6_ROWS=rows-v8.jq (row <id>-A, V8_MERGE) and records
22# that module and its sha256 as v6_rows_module; the verdict is score-rows.sh
23# (scoring-v5) over np1-v8.decl.json. Usage (inside the caller's quietlock hold,
24# ACCEPTANCE-v6 Section 8):
25# AIEN_BIN=... AIEN_MODEL_PATH=... AIEN_TOKENIZER_PATH=... \
26# run-v8.sh RUN_BASE OUT_DIR SC_COMMIT OMEGA_COMPOSE_COMMIT OMEGA_GPU_COMMIT REFERENCE_BIN MERGE_BIN
27# MERGE_BIN is the built np1_edit_merge example; for an edit launch it re-derives the proposal
28# from the accepted reply and the pre-seed and its JSON is passed to make-receipt.sh as V8_MERGE.
29# Writes RUN_BASE/<launch>/ (run roots), RUN_BASE/R1.reference.json, one
30# receipt per launch in OUT_DIR, OUT_DIR/v8-results.jsonl and OUT_DIR/v8-score.json.
31set -u
32HERE=$(cd "$(dirname "$0")" && pwd)
33BASE=${1:?RUN_BASE} OUT=${2:?OUT_DIR} SC=${3:?SC_COMMIT} OMC=${4:?OMEGA_COMPOSE} OMG=${5:?OMEGA_GPU} REFBIN=${6:?REFERENCE_BIN} MERGEBIN=${7:?MERGE_BIN}
34# ACCEPTANCE-v8 Section 6 (B1): the run path is pinned, so every prompt's "Authorized workspace" text
35# is known before the run, and the run is fresh (one run, nothing reused).
36PINNED_BASE=/home/drakestapleton/workspace/np1-v8-runs
37[ "$BASE" = "$PINNED_BASE" ] || { echo "run-v8: RUN_BASE must be $PINNED_BASE" >&2; exit 2; }
38[ ! -e "$BASE" ] || { echo "run-v8: $BASE already exists (a v8 run is fresh and happens once)" >&2; exit 2; }
39TASKS=$HERE/tasks-v8.json
40DECL=$HERE/../scoring/declarations/np1-v8.decl.json
41SCORER=$HERE/../scoring/score-rows.sh
42[ -f "$DECL" ] && [ -x "$SCORER" ] && [ -x "$REFBIN" ] && [ -x "$MERGEBIN" ] || { echo "run-v8: declaration, scorer, reference binary or merge binary missing" >&2; exit 2; }
43MODEL_DIR=$(dirname "${AIEN_MODEL_PATH:?}")
44mkdir -p "$BASE" "$OUT"
45RES=$OUT/v8-results.jsonl
46: >"$RES"
47for id in $(jq -r '.tasks[].id' "$TASKS"); do
48 t=$(jq -c --arg id "$id" '.tasks[] | select(.id == $id)' "$TASKS")
49 goal=$(jq -r .goal <<<"$t"); max=$(jq -r .max_tokens <<<"$t"); seed=$(jq -r '.seed // empty' <<<"$t")
50 seed_dir=; [ -n "$seed" ] && seed_dir=$HERE/$seed
51 NP1_GOAL=$goal AIEN_COMPOSE_MAX_TOKENS=$max NP1_SEED_DIR=$seed_dir \
52 bash "$HERE/run-campaign.sh" "$BASE/$id" >"$BASE/$id.driver.out" 2>&1
53 echo "launch $id driver exit $? (max_tokens $max${seed:+, seed $seed})"
54 ref=
55 if [ "$(jq -r .kind <<<"$t")" = identity ] && [ -d "$BASE/$id/ws" ]; then
56 ws=$(cd "$BASE/$id/ws" && pwd -P)
57 "$REFBIN" "$MODEL_DIR" "$goal" "$ws" "$max" new >"$BASE/$id.reference.json" 2>"$BASE/$id.reference.err"
58 echo "launch $id CPU reference exit $?"
59 ref=$BASE/$id.reference.json
60 fi
61 if [ -f "$BASE/$id/run.json" ]; then
62 # ACCEPTANCE-v8 Section 2, row <id>-A: for an edit launch, re-derive the proposal from the
63 # accepted attempt's reply (the last attempt with outcome "parsed") and the pre-seed.
64 v8merge=null
65 if [ "$(jq -r .kind <<<"$t")" = edit ] && [ -f "$BASE/$id/s3-report.json" ]; then
66 rf=$BASE/$id.accepted-reply.txt
67 if jq -e '[.proposal_attempts // [] | .[] | select(.outcome == "parsed")] | length > 0' "$BASE/$id/s3-report.json" >/dev/null 2>&1; then
68 jq -j '[.proposal_attempts[] | select(.outcome == "parsed")] | last | .text' "$BASE/$id/s3-report.json" >"$rf"
69 m=$("$MERGEBIN" "$(jq -r .destination <<<"$t")" "$HERE/$seed/$(jq -r .destination <<<"$t")" "$rf" 2>"$BASE/$id.merge.err")
70 if jq . <<<"$m" >/dev/null 2>&1; then v8merge=$(jq -c . <<<"$m"); fi
71 fi
72 echo "launch $id edit re-derivation: $(jq -r 'if . == null then "none" else "ok=\(.ok)" end' <<<"$v8merge")"
73 fi
74 v5env=(); [ "$(jq -r '.destination // empty' <<<"$t")" != "" ] && [ "${id#N}" = "$id" ] && \
75 v5env=(TASK_ID="$id" TASK_SPEC="$TASKS" TASK_ACCEPTANCE="$HERE/ACCEPTANCE-v8.md")
76 env "${v5env[@]}" V6_ROWS=rows-v8.jq V8_MERGE="$v8merge" V6_TASK="$id" V6_MAX_TOKENS="$max" V6_REFERENCE="$ref" \
77 SPEC="ACCEPTANCE-v8.md spec_version 8" bash "$HERE/make-receipt.sh" \
78 "$BASE/$id" "$OUT" "$SC" "$OMC" "$OMG" 0 "NEXT-PHASE-1 v8 launch $id" >"$BASE/$id.receipt.out" 2>&1
79 rec=$OUT/$(head -1 "$BASE/$id.receipt.out" | sed -n 's/.*receipt \([0-9a-f]*\.json\).*/\1/p')
80 if [ -f "$rec" ]; then bash "$HERE/v8-results.sh" "$id" "$rec" >>"$RES"
81 else bash "$HERE/v8-results.sh" "$id" - "$DECL" "receipt not written" >>"$RES"; fi
82 echo "launch $id receipt $(basename "$rec")"
83 else
84 bash "$HERE/v8-results.sh" "$id" - "$DECL" "launch failed: no run.json" >>"$RES" # ACCEPTANCE-v6 Section 7
85 echo "launch $id FAILED to launch"
86 fi
87 jq -r --arg id "$id" 'select(.row | startswith($id + "/")) | select(.verdict != "PASS") | " \(.verdict) \(.row)"' "$RES"
88done
89bash "$SCORER" "$DECL" "$RES" >"$OUT/v8-score.json"; rc=$?
90echo "NEXT-PHASE-1 v8 campaign verdict (scoring-v5, score-rows.sh exit $rc): $(jq -r .verdict "$OUT/v8-score.json" 2>/dev/null || echo ERROR)"
91exit $rc