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 / crates / cortex-rs / scripts / reproduce.sh

96 lines · 3377 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
17set -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
23PORT=${PORT:-18089}
24HOST=${HOST:-127.0.0.1}
25TOKEN="cortex-reproduce-$(date +%s)"
26TMP_DB=$(mktemp /tmp/cortex_reproduce_XXXXXX.db)
27trap 'rm -f "$TMP_DB"* 2>/dev/null || true' EXIT
28
29echo "================================================================================"
30echo "CORTEX-RS TURNKEY HTTP VERIFICATION RUNNER"
31echo "Port: $PORT | Ephemeral DB: $TMP_DB"
32echo "================================================================================"
33
34# Locate binary: prioritize local target/release
35if [ -x "./target/release/cortex-rs" ]; then
36 BIN="./target/release/cortex-rs"
37elif command -v cortex-rs >/dev/null 2>&1; then
38 BIN="cortex-rs"
39else
40 echo "Building release binary..."
41 cargo build --release --quiet
42 BIN="./target/release/cortex-rs"
43fi
44
45# Launch cortex-rs in background
46export CORTEX_TOKEN="$TOKEN"
47"$BIN" --host "$HOST" --port "$PORT" --db-path "$TMP_DB" &
48PID=$!
49trap 'kill $PID 2>/dev/null || true; rm -f "$TMP_DB"* 2>/dev/null || true' EXIT
50
51# Wait for health endpoint
52echo -n "Waiting for cortex-rs server on http://$HOST:$PORT/health..."
53READY=0
54for _ 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
60done
61
62if [ "$READY" -ne 1 ]; then
63 echo " FAILED to start server."
64 exit 1
65fi
66echo " OK"
67
68# Ingest test entities
69echo -n "Ingesting sample knowledge records..."
70for 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
83done
84echo " OK (5 entities committed)"
85
86# Execute search and measure latency
87echo "Testing FTS5 lexical search latency..."
88SEARCH_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
92echo "$SEARCH_OUT"
93
94echo "================================================================================"
95echo "VERIFICATION PASSED: cortex-rs is running and responsive."
96echo "================================================================================"