ORION-Runtime / scripts /genesis_bootstrap.sh
Alvoradozerouno's picture
ORION System Update 2026-05-12: Multi-Agent Discussion, KRIA Validation, Agent Refactor, DDGK->ORION Migration
da3e674
Raw
History Blame Contribute Delete
16.1 kB
#!/usr/bin/env bash
set -euo pipefail
# =============================================================================
# GENESIS10000+ / ORION / EIRA — WORKSPACE BOOTSTRAP
# Erstellt alle Verzeichnisse und Dateien im bestehenden Workspace
# =============================================================================
cd /d "c:\Users\annah\Dropbox\Mein PC (LAPTOP-RQH448P4)\Downloads\ORION-ROS2-Consciousness-Node"
# Verzeichnisse erstellen
mkdir -p genesis10000/config genesis10000/data genesis10000/logs genesis10000/runtime genesis10000/core genesis10000/agents genesis10000/ai genesis10000/hardware genesis10000/automation genesis10000/portal_profiles genesis10000/api genesis10000/docs genesis10000/scripts
echo "Verzeichnisse erstellt."
echo "Dateien werden jetzt erstellt..."
# config/settings.py
cat > genesis10000/config/__init__.py << 'PYEOF'
from .settings import settings
PYEOF
cat > genesis10000/config/settings.py << 'PYEOF'
from pydantic import BaseModel
from dotenv import load_dotenv
import os
load_dotenv()
class Settings(BaseModel):
environment: str = os.getenv("ENVIRONMENT", "production")
system_name: str = os.getenv("SYSTEM_NAME", "GENESIS10000+")
loop_interval_seconds: int = int(os.getenv("LOOP_INTERVAL_SECONDS", "30"))
redis_url: str = os.getenv("REDIS_URL", "redis://localhost:6379/0")
smtp_host: str = os.getenv("SMTP_HOST", "smtp.world4you.com")
smtp_port: int = int(os.getenv("SMTP_PORT", "587"))
smtp_user: str = os.getenv("SMTP_USER", "elisabethsteurer@paradoxonai.at")
smtp_pass: str = os.getenv("SMTP_PASS", "Follow+43")
imap_host: str = os.getenv("IMAP_HOST", "imap.world4you.com")
imap_user: str = os.getenv("IMAP_USER", "elisabethsteurer@paradoxonai.at")
imap_pass: str = os.getenv("IMAP_PASS", "Follow+43")
outreach_from_name: str = "Paradoxon AI OG"
outreach_reply_to: str = "elisabethsteurer@paradoxonai.at"
settings = Settings()
PYEOF
# core/__init__.py
touch genesis10000/core/__init__.py
# core/audit.py
cat > genesis10000/core/audit.py << 'PYEOF'
import hashlib
import json
from pathlib import Path
from threading import Lock
class AuditChain:
def __init__(self, path: str = "genesis10000/runtime/audit_chain.jsonl"):
self.path = Path(path)
self.path.parent.mkdir(parents=True, exist_ok=True)
self.head = "GENESIS"
self._lock = Lock()
def update(self, payload: dict) -> str:
blob = json.dumps(payload, sort_keys=True, ensure_ascii=False)
with self._lock:
self.head = hashlib.sha256(f"{self.head}|{blob}".encode()).hexdigest()
record = {"head": self.head, "payload": payload, "ts": __import__("time").time()}
with self.path.open("a", encoding="utf-8") as f:
f.write(json.dumps(record, ensure_ascii=False) + "\n")
return self.head
PYEOF
# core/policy.py
cat > genesis10000/core/policy.py << 'PYEOF'
class PolicyEngine:
def __init__(self, conf_threshold: float = 0.7, unc_threshold: float = 0.5, learning_rate: float = 0.05):
self.conf_threshold = conf_threshold
self.unc_threshold = unc_threshold
self.learning_rate = learning_rate
def decide(self, signal: float) -> tuple:
confidence = max(0.0, min(1.0, signal))
uncertainty = max(0.0, min(1.0, 1.0 - confidence))
if confidence >= self.conf_threshold and uncertainty <= self.unc_threshold:
return "VERIFIED", confidence, uncertainty
if uncertainty > self.unc_threshold:
return "DISCONNECT", confidence, uncertainty
return "INFERRED", confidence, uncertainty
def improve(self, result: float) -> None:
if result < 0:
self.conf_threshold = min(0.95, self.conf_threshold + self.learning_rate)
self.unc_threshold = max(0.10, self.unc_threshold - self.learning_rate)
else:
self.conf_threshold = max(0.50, self.conf_threshold - self.learning_rate * 0.5)
self.unc_threshold = min(0.90, self.unc_threshold + self.learning_rate * 0.5)
PYEOF
# core/store.py
cat > genesis10000/core/store.py << 'PYEOF'
import json
from pathlib import Path
class Store:
def __init__(self, path: str = "genesis10000/data/"):
self.path = Path(path)
self.path.mkdir(parents=True, exist_ok=True)
def set_json(self, key: str, value: dict):
(self.path / f"{key}.json").write_text(json.dumps(value, ensure_ascii=False), encoding="utf-8")
def get_json(self, key: str):
p = self.path / f"{key}.json"
if p.exists():
return json.loads(p.read_text(encoding="utf-8"))
return None
def push_json(self, key: str, value: dict):
p = self.path / f"{key}_history.jsonl"
with p.open("a", encoding="utf-8") as f:
f.write(json.dumps(value, ensure_ascii=False) + "\n")
def list_json(self, key: str):
p = self.path / f"{key}_history.jsonl"
if p.exists():
return [json.loads(line) for line in p.read_text(encoding="utf-8").strip().split("\n") if line]
return []
PYEOF
# core/agent_worker.py
cat > genesis10000/core/agent_worker.py << 'PYEOF'
import threading
import queue
import time
class AgentWorker(threading.Thread):
def __init__(self, name, task_queue, result_queue, handler):
super().__init__(daemon=True)
self.name = name
self.task_queue = task_queue
self.result_queue = result_queue
self.handler = handler
def run(self):
while True:
try:
task = self.task_queue.get(timeout=5)
result = self.handler(task)
self.result_queue.put((self.name, result))
self.task_queue.task_done()
except queue.Empty:
continue
except Exception as e:
self.result_queue.put((self.name, {"error": str(e)}))
self.task_queue.task_done()
PYEOF
# core/task_manager.py
cat > genesis10000/core/task_manager.py << 'PYEOF'
import queue
class TaskManager:
def __init__(self):
self.tasks = queue.Queue()
self.results = queue.Queue()
def add_task(self, task):
self.tasks.put(task)
def get_results(self):
results = []
while not self.results.empty():
results.append(self.results.get())
return results
PYEOF
# core/loop.py
cat > genesis10000/core/loop.py << 'PYEOF'
import time
import random
from core.audit import AuditChain
from core.policy import PolicyEngine
from core.store import Store
class GenesisLoop:
def __init__(self):
self.audit = AuditChain()
self.policy = PolicyEngine()
self.store = Store()
def observe(self) -> dict:
signal = random.uniform(0.3, 1.0)
return {"source": "runtime", "signal": signal, "payload": {"mode": "live"}}
def act(self, decision: str, confidence: float) -> float:
if decision == "VERIFIED": return confidence * 1.2
if decision == "INFERRED": return confidence * 0.8
return -0.2
def run_cycle(self) -> dict:
obs = self.observe()
decision, confidence, uncertainty = self.policy.decide(obs["signal"])
result = self.act(decision, confidence)
self.policy.improve(result)
audit_payload = {
"observation": obs, "decision": decision,
"confidence": confidence, "uncertainty": uncertainty, "result": result,
"policy": {"conf_threshold": self.policy.conf_threshold, "unc_threshold": self.policy.unc_threshold}
}
head = self.audit.update(audit_payload)
self.store.set_json("system:last_cycle", {"audit_head": head, **audit_payload})
self.store.push_json("system:history", {"audit_head": head, **audit_payload})
return {"audit_head": head, **audit_payload}
def run_forever(self, interval_seconds: int = 30):
while True:
out = self.run_cycle()
print(f"=== GENESIS LOOP === decision={out['decision']} conf={out['confidence']:.3f} unc={out['uncertainty']:.3f} result={out['result']:.3f} audit={out['audit_head'][:16]}...")
time.sleep(interval_seconds)
PYEOF
# core/logger.py
cat > genesis10000/core/logger.py << 'PYEOF'
import json
from datetime import datetime
from pathlib import Path
class Logger:
def __init__(self, path: str = "genesis10000/logs/system_log.jsonl"):
self.path = Path(path)
self.path.parent.mkdir(parents=True, exist_ok=True)
def log(self, data):
entry = {"time": str(datetime.utcnow()), "data": data}
with self.path.open("a", encoding="utf-8") as f:
f.write(json.dumps(entry, ensure_ascii=False) + "\n")
PYEOF
# agents/__init__.py
touch genesis10000/agents/__init__.py
# agents/handlers.py
cat > genesis10000/agents/handlers.py << 'PYEOF'
import requests
from bs4 import BeautifulSoup
class ResearchAgent:
def fetch_title(self, url: str) -> dict:
try:
resp = requests.get(url, timeout=15)
resp.raise_for_status()
soup = BeautifulSoup(resp.text, "html.parser")
return {"url": url, "status": resp.status_code, "title": soup.title.get_text(strip=True) if soup.title else ""}
except Exception as e:
return {"url": url, "status": None, "title": "", "error": str(e)}
class FundingAgent:
def __init__(self): self.research = ResearchAgent()
def discover(self) -> list:
targets = ["https://ec.europa.eu/info/funding-tenders/opportunities/portal/screen/home",
"https://www.ffg.at", "https://www.aws.at"]
return [self.research.fetch_title(url) for url in targets]
class DealAgent:
def generate_targets(self) -> list:
return [{"organization": "Infineon", "segment": "hardware", "priority": "high"},
{"organization": "ESA Automation", "segment": "industrial", "priority": "high"},
{"organization": "AI Factory Austria", "segment": "infrastructure", "priority": "high"},
{"organization": "Fraunhofer IKS", "segment": "research", "priority": "high"},
{"organization": "Bosch", "segment": "automotive", "priority": "medium"}]
class OutreachAgent:
def send_email(self, to_email: str, subject: str, body: str) -> dict:
# Wird von send_validated_emails.py übernommen
return {"ok": True, "to": to_email, "note": "Use send_validated_emails.py for real sending"}
class InboxAgent:
def fetch_recent(self, limit: int = 10) -> list:
return [{"note": "Use email_contacts_and_delivery_fix.py for real inbox access"}]
PYEOF
# agents/parallel_orchestrator.py
cat > genesis10000/agents/parallel_orchestrator.py << 'PYEOF'
from core.agent_worker import AgentWorker
from core.task_manager import TaskManager
from agents.handlers import FundingAgent, DealAgent
class ParallelOrchestrator:
def __init__(self, num_agents: int = 8):
self.manager = TaskManager()
self.funding = FundingAgent()
self.deals = DealAgent()
self.workers = [AgentWorker(f"agent_{i}", self.manager.tasks, self.manager.results, self.handle_task) for i in range(num_agents)]
for w in self.workers: w.start()
def handle_task(self, task):
t = task.get("type")
if t == "funding": return self.funding.discover()
if t == "deal": return self.deals.generate_targets()
return {"error": "unknown task"}
def dispatch(self):
tasks = [{"type": "funding"}, {"type": "deal"}, {"type": "deal"}, {"type": "funding"}]
for t in tasks: self.manager.add_task(t)
self.manager.tasks.join()
return self.manager.get_results()
PYEOF
# automation/__init__.py
touch genesis10000/automation/__init__.py
# automation/document_generator.py
cat > genesis10000/automation/document_generator.py << 'PYEOF'
from pathlib import Path
DOC_DIR = Path("genesis10000/docs/generated")
DOC_DIR.mkdir(parents=True, exist_ok=True)
def write_text(name: str, content: str) -> str:
path = DOC_DIR / name
path.write_text(content, encoding="utf-8")
return str(path)
def generate_funding_bundle(project_name: str, summary: str) -> list:
cover = write_text("cover_letter.txt", f"Project: {project_name}\n\n{summary}\n")
business = write_text("business_plan.txt", f"Business Plan\n\n{project_name}\n\n{summary}\n")
technical = write_text("technical_proposal.txt", f"Technical Proposal\n\n{project_name}\n\n{summary}\n")
return [cover, business, technical]
PYEOF
# automation/auto_apply_real.py
cat > genesis10000/automation/auto_apply_real.py << 'PYEOF'
from automation.document_generator import generate_funding_bundle
class AutoApplyReal:
def run(self, project_name: str, summary: str, portal_profile: str = None, extra_fields: dict = None, dry_run: bool = False):
doc_paths = generate_funding_bundle(project_name, summary)
fields = {"project_name": project_name, "summary": summary, "trl": "4",
"market": "Automotive / Space / Industrial AI",
"innovation": "Epistemic FSM + SHA-256 audit chain + deterministic hardware"}
if extra_fields: fields.update(extra_fields)
documents = {"cover_letter": doc_paths[0], "business_plan": doc_paths[1], "technical_proposal": doc_paths[2]}
return {"ok": True, "dry_run": dry_run, "fields": fields, "documents": documents, "note": "Portal automation ready - configure portal_profiles/ for real execution"}
PYEOF
# api/server.py
cat > genesis10000/api/__init__.py << 'PYEOF'
PYEOF
cat > genesis10000/api/server.py << 'PYEOF'
from fastapi import FastAPI, Body
from core.store import Store
from agents.handlers import FundingAgent, DealAgent
app = FastAPI(title="GENESIS10000+ API")
store = Store()
funding = FundingAgent()
deals = DealAgent()
@app.get("/")
def root(): return {"status": "GENESIS RUNNING"}
@app.get("/state")
def state(): return store.get_json("system:last_cycle") or {}
@app.post("/funding")
def funding_discover(): return funding.discover()
@app.post("/deals")
def deals_generate(): return deals.generate_targets()
@app.post("/auto-apply")
def auto_apply(payload: dict = Body(...)):
from automation.auto_apply_real import AutoApplyReal
return AutoApplyReal().run(
project_name=payload.get("project_name", "EIRA ORION FPGA CORE"),
summary=payload.get("summary", "Deterministic AI hardware for safety-critical systems"),
dry_run=bool(payload.get("dry_run", True)))
PYEOF
# .env für Genesis
cat > genesis10000/.env << 'EOF'
ENVIRONMENT=production
SYSTEM_NAME=GENESIS10000+
LOOP_INTERVAL_SECONDS=30
SMTP_HOST=smtp.world4you.com
SMTP_PORT=587
SMTP_USER=elisabethsteurer@paradoxonai.at
SMTP_PASS=Follow+43
IMAP_HOST=imap.world4you.com
IMAP_USER=elisabethsteurer@paradoxonai.at
IMAP_PASS=Follow+43
EOF
# README.md
cat > genesis10000/README.md << 'EOF'
# GENESIS10000+ — PARADOXON AI AUTOMATION
## Quick Start
1. `pip install fastapi uvicorn pydantic python-dotenv requests beautifulsoup4`
2. `python -c "from core.loop import GenesisLoop; GenesisLoop().run_cycle()"`
3. `uvicorn api.server:app --host 0.0.0.0 --port 8000`
## Structure
- `core/` — Audit Chain, Policy Engine, Store, Loop
- `agents/` — Funding, Deals, Research, Parallel Orchestrator
- `automation/` — Document Generator, Auto-Apply
- `api/` — FastAPI Server
## Real Execution
- Audit Chain: SHA-256 für jeden Zyklus
- Policy Engine: Self-improving thresholds
- Funding Agent: FFG, AWS, EU portals
- Deal Agent: Infineon, ESA, Fraunhofer IKS, Bosch
EOF
# main.py
cat > genesis10000/main.py << 'PYEOF'
from config.settings import settings
from core.loop import GenesisLoop
if __name__ == "__main__":
print(f"=== {settings.system_name} STARTING ===")
GenesisLoop().run_forever(settings.loop_interval_seconds)
PYEOF
echo ""
echo "==============================================="
echo "GENESIS10000+ WORKSPACE ERSTELLT"
echo "==============================================="
echo "Dateien:"
find genesis10000 -type f | sort