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/calibration/scripts/candidate_env.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 / calibration / scripts / candidate_env.sh` 77 lines ยท 3258 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 # Turing calibration (CAL-0 / EXP-001): Candidate Environment. 18 # 19 # usage: candidate_env.sh [--workdir DIR] [--dev DIR]... [--ro DIR]... [--net] -- COMMAND [ARG...] 20 # 21 # Runs COMMAND in a bubblewrap jail that can see ONLY: 22 # * the system (/usr, /etc read-only), an empty /tmp and an empty HOME; 23 # * the candidate working directory (default: the current git worktree), read-write; 24 # * the git common directory of that worktree, read-only (so `git log/show` work); 25 # * development data (default: ~/aien-data/crumbline), read-only; 26 # * extra read-only paths given with --ro (for example the public profile). 27 # It can NOT see the sealed root ($TC_SEALED_ROOT, default ~/aien-data/turing-cal/sealed) 28 # or the evaluator output root ($TC_EVAL_ROOT): those paths do not exist in the jail. 29 # Any requested bind that overlaps them is refused before the jail starts. 30 # Network is off unless --net is given (the evaluator is never reachable either way: 31 # it runs offline in its own jail and exposes no service). 32 # 33 # Exit code: COMMAND's exit code, or 3 when the jail refuses to start. 34 set -euo pipefail 35 here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 36 # shellcheck source=tc_jail_lib.sh 37 . "$here/tc_jail_lib.sh" 38 39 workdir="" 40 devs=() 41 ros=() 42 net=0 43 while [ $# -gt 0 ]; do 44 case "$1" in 45 --workdir) workdir="$2"; shift 2 ;; 46 --dev) devs+=("$2"); shift 2 ;; 47 --ro) ros+=("$2"); shift 2 ;; 48 --net) net=1; shift ;; 49 --) shift; break ;; 50 *) tc_die "unknown option '$1' (use -- before the command)" ;; 51 esac 52 done 53 [ $# -gt 0 ] || tc_die "no command given" 54 [ -n "$workdir" ] || workdir="$(git rev-parse --show-toplevel 2>/dev/null || pwd)" 55 [ ${#devs[@]} -gt 0 ] || devs=("$HOME/aien-data/crumbline") 56 57 tc_have_bwrap 58 hidden=("$TC_SEALED_ROOT" "$TC_EVAL_ROOT") 59 tc_refuse_hidden "$workdir" workdir "${hidden[@]}" 60 for d in "${devs[@]}"; do tc_refuse_hidden "$d" "dev data" "${hidden[@]}"; done 61 for d in "${ros[@]+"${ros[@]}"}"; do tc_refuse_hidden "$d" "read-only path" "${hidden[@]}"; done 62 63 tc_base_args 64 if [ "$net" = 1 ]; then 65 TC_ARGS+=(--share-net) 66 if [ -d /run/systemd/resolve ]; then tc_ro /run/systemd/resolve; fi 67 fi 68 for d in "${devs[@]}"; do tc_ro "$d"; done 69 for d in "${ros[@]+"${ros[@]}"}"; do tc_ro "$d"; done 70 gitcommon="$(git -C "$workdir" rev-parse --path-format=absolute --git-common-dir 2>/dev/null || true)" 71 if [ -n "$gitcommon" ] && [ -d "$gitcommon" ]; then 72 tc_refuse_hidden "$gitcommon" "git dir" "${hidden[@]}" 73 tc_ro "$gitcommon" 74 fi 75 tc_rw "$workdir" 76 TC_ARGS+=(--setenv TC_ENV candidate --chdir "$(tc_real "$workdir")") 77 exec "$TC_BWRAP" "${TC_ARGS[@]}" -- "$@"