#!/usr/bin/env bash # Run a mission/task file through the config-driven container path. # # Usage: scripts/run-task.sh run (also: validate , list) # # Ensures the configuration is valid and the data root carries the # ownership marker before any task executes. set -euo pipefail cd "$(dirname "$0")/.." # shellcheck source=common.sh source scripts/common.sh load_config load_release # compose requires MOSAIC_IMAGE_TAG; task runs are release-scoped too bootstrap_runtime_dir # Workers never auto-align releases (no builds or model gates mid-automation); # drift is reported so the operator or a human-facing launcher can align. if [ -f "$MOSAIC_DEV_DIR/state/active.json" ]; then ACTIVE_REL="$(node -e 'try{const p=JSON.parse(require("fs").readFileSync(process.argv[1],"utf8"));process.stdout.write(p.release||"")}catch{}' "$MOSAIC_DEV_DIR/state/active.json")" [ "$ACTIVE_REL" = "$MOSAIC_RELEASE" ] || echo "run-task: note: release drift (active: ${ACTIVE_REL:-none}, desired: $MOSAIC_RELEASE) - run scripts/release.sh ensure to align" >&2 fi if [ ! -f "$MOSAIC_DEV_DIR/user/USER.md" ]; then echo "run-task: note: user profile not onboarded - continuing without user context (scripts/onboard.sh)" >&2 fi exec node scripts/mosaic-task.mjs "$@"