mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-08-13 18:10:36 +00:00
Create 4-Infrastructure/lib/ with canonical implementations of:
- hashing.py: sha256_bytes, sha256_text, sha256_file
- q16.py: Q16_16 fixed-point constants and arithmetic
- jsonl.py: load_json, load_jsonl, write_jsonl, stable_json, canonical_json_bytes
- fraction_utils.py: Fraction serialization helpers for hardware probes
Refactor 66 files across 4-Infrastructure/{hardware,shim,infra} and
5-Applications/{scripts,tools-scripts,hutter_prize,text-to-cad} to import
from the shared library instead of maintaining local copies.
4-Infrastructure/auto/lib/q16.py now re-exports from lib.q16.
Net: -743 lines (490 added, 1233 removed)
Build: not applicable (Python-only change, py_compile verified on all 71 files)
Co-Authored-By: Allaun Silverfox <bigdataiscoming+9i37y6j2@protonmail.com>
68 lines
2.6 KiB
Python
68 lines
2.6 KiB
Python
# ==============================================================================
|
|
# COPYRIGHT NO ONE EVERYWHERE LLC (WYOMING HOLDING COMPANY)
|
|
# PROJECT: SOVEREIGN STACK
|
|
# This artifact is entirely proprietary and cryptographically proven.
|
|
# Open-Source usage requires explicit permission from Brandon Scott Schneider.
|
|
# ==============================================================================
|
|
|
|
# [WARDEN BOUNDARY ENFORCEMENT INJECTED]
|
|
import sys
|
|
import os
|
|
try:
|
|
from io_harness_compat import spawn_isolated_process, fetch_network_resource
|
|
except ImportError:
|
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
|
from io_harness_compat import spawn_isolated_process, fetch_network_resource
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[3] / "4-Infrastructure"))
|
|
from lib.hashing import sha256_text
|
|
|
|
# import subprocess (REMOVED BY WARDEN)
|
|
|
|
BASE_DIR = Path(__file__).parent.parent.resolve()
|
|
DATA_FILE = BASE_DIR / "hqw_atomic_combinations.json"
|
|
MANIFEST_BIN = BASE_DIR / "scripts" / "file_manifest_builder.py"
|
|
MANIFEST_OUT = BASE_DIR / "hqw_atomic_combinations.manifest.json"
|
|
METADATA_OUT = BASE_DIR / "hqw_materials_metadata.jsonl"
|
|
CHUNK_STORE = BASE_DIR / "hqw_chunks"
|
|
def generate_metadata():
|
|
print(f"[*] Reading {DATA_FILE}...")
|
|
with open(DATA_FILE, 'r') as f:
|
|
combinations = json.load(f)
|
|
|
|
print(f"[*] Generating per-combination metadata...")
|
|
with open(METADATA_OUT, 'w') as f:
|
|
for comb in combinations:
|
|
# Hash the formula + register_bits as a unique key for the combination
|
|
# This follows the 'valence as register' metadata requirement
|
|
data_str = json.dumps(comb, sort_keys=True)
|
|
digest = sha256_text(data_str)
|
|
comb['sha256'] = digest
|
|
f.write(json.dumps(comb) + "\n")
|
|
|
|
print(f"[+] Metadata saved to {METADATA_OUT}")
|
|
|
|
def generate_manifest():
|
|
print(f"[*] Building file-level manifest using file_manifest_builder.py...")
|
|
cmd = [
|
|
"python3", str(MANIFEST_BIN), "build",
|
|
"--input", str(DATA_FILE),
|
|
"--manifest-out", str(MANIFEST_OUT),
|
|
"--chunk-store", str(CHUNK_STORE)
|
|
]
|
|
result = subprocess.run(cmd, capture_output=True, text=True)
|
|
if result.returncode == 0:
|
|
print(f"[+] Manifest saved to {MANIFEST_OUT}")
|
|
print(f"[*] Chunk store created in {CHUNK_STORE}")
|
|
else:
|
|
print(f"[!] Manifest build failed: {result.stderr}")
|
|
|
|
if __name__ == "__main__":
|
|
if not DATA_FILE.exists():
|
|
print(f"[!] Error: {DATA_FILE} not found. Run the HQW simulation first.")
|
|
else:
|
|
generate_metadata()
|
|
generate_manifest()
|