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 / crates / cortex-rs / scripts / reproduce.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 | set -euo pipefail |
| 18 | |
| 19 | # Sovereign Reproduction Runner for cortex-rs |
| 20 | # Tests live HTTP server lifecycle: startup, health probe, entity ingestion, |
| 21 | # FTS5 lexical search latency, and graph traversal. |
| 22 | |
| 23 | PORT=${PORT:-18089} |
| 24 | HOST=${HOST:-127.0.0.1} |
| 25 | TOKEN="cortex-reproduce-$(date +%s)" |
| 26 | TMP_DB=$(mktemp /tmp/cortex_reproduce_XXXXXX.db) |
| 27 | trap 'rm -f "$TMP_DB"* 2>/dev/null || true' EXIT |
| 28 | |
| 29 | echo "================================================================================" |
| 30 | echo "CORTEX-RS TURNKEY HTTP VERIFICATION RUNNER" |
| 31 | echo "Port: $PORT | Ephemeral DB: $TMP_DB" |
| 32 | echo "================================================================================" |
| 33 | |
| 34 | # Locate binary: prioritize local target/release |
| 35 | if [ -x "./target/release/cortex-rs" ]; then |
| 36 | BIN="./target/release/cortex-rs" |
| 37 | elif command -v cortex-rs >/dev/null 2>&1; then |
| 38 | BIN="cortex-rs" |
| 39 | else |
| 40 | echo "Building release binary..." |
| 41 | cargo build --release --quiet |
| 42 | BIN="./target/release/cortex-rs" |
| 43 | fi |
| 44 | |
| 45 | # Launch cortex-rs in background |
| 46 | export CORTEX_TOKEN="$TOKEN" |
| 47 | "$BIN" --host "$HOST" --port "$PORT" --db-path "$TMP_DB" & |
| 48 | PID=$! |
| 49 | trap 'kill $PID 2>/dev/null || true; rm -f "$TMP_DB"* 2>/dev/null || true' EXIT |
| 50 | |
| 51 | # Wait for health endpoint |
| 52 | echo -n "Waiting for cortex-rs server on http://$HOST:$PORT/health..." |
| 53 | READY=0 |
| 54 | for _ in $(seq 1 30); do |
| 55 | if curl -s "http://$HOST:$PORT/health" | grep -q '"status":"ok"'; then |
| 56 | READY=1 |
| 57 | break |
| 58 | fi |
| 59 | sleep 0.1 |
| 60 | done |
| 61 | |
| 62 | if [ "$READY" -ne 1 ]; then |
| 63 | echo " FAILED to start server." |
| 64 | exit 1 |
| 65 | fi |
| 66 | echo " OK" |
| 67 | |
| 68 | # Ingest test entities |
| 69 | echo -n "Ingesting sample knowledge records..." |
| 70 | for i in 1 2 3 4 5; do |
| 71 | curl -s -X POST "http://$HOST:$PORT/api/cortex/write" \ |
| 72 | -H "Authorization: Bearer $TOKEN" \ |
| 73 | -H "Content-Type: application/json" \ |
| 74 | -d "{ |
| 75 | \"kind\": \"entity\", |
| 76 | \"value\": { |
| 77 | \"space\": \"atlas-memory\", |
| 78 | \"canonicalName\": \"system_module_$i\", |
| 79 | \"entityType\": \"discovery\", |
| 80 | \"content\": \"Blackwell GB10 unified memory verification node $i with hardware TPM attestation.\" |
| 81 | } |
| 82 | }" >/dev/null |
| 83 | done |
| 84 | echo " OK (5 entities committed)" |
| 85 | |
| 86 | # Execute search and measure latency |
| 87 | echo "Testing FTS5 lexical search latency..." |
| 88 | SEARCH_OUT=$(curl -s -w "\nHTTP_CODE:%{http_code}\nTIME_TOTAL:%{time_total}s\n" \ |
| 89 | -H "Authorization: Bearer $TOKEN" \ |
| 90 | "http://$HOST:$PORT/api/cortex/search?q=Blackwell%20memory&limit=5") |
| 91 | |
| 92 | echo "$SEARCH_OUT" |
| 93 | |
| 94 | echo "================================================================================" |
| 95 | echo "VERIFICATION PASSED: cortex-rs is running and responsive." |
| 96 | echo "================================================================================" |